Improved DN parsing
This commit is contained in:
parent
770a99ad0e
commit
8d2651b33d
|
@ -289,5 +289,12 @@
|
|||
var dn = new DistinguishedName("OU=Employees,OU=Marketing,DC=adatum,DC=com");
|
||||
Assert.AreEqual("DC=adatum,DC=com", dn.RootNamingContext.ToString());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void DistinguishedName_RootNamingContext_Vector3()
|
||||
{
|
||||
var dn = new DistinguishedName("DC=LON-CL1,cn=MicrosoftDNS,DC=DomainDnsZones,DC=adatum,DC=com");
|
||||
Assert.AreEqual("DC=DomainDnsZones,DC=adatum,DC=com", dn.RootNamingContext.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,7 +96,10 @@
|
|||
{
|
||||
get
|
||||
{
|
||||
var dcComponents = this.components.Where(component => component.Name.Equals(CommonDirectoryAttributes.DomainComponent, StringComparison.InvariantCultureIgnoreCase));
|
||||
var dcComponents = this.components
|
||||
.Reverse<DistinguishedNameComponent>()
|
||||
.TakeWhile(component => component.Name.Equals(CommonDirectoryAttributes.DomainComponent, StringComparison.InvariantCultureIgnoreCase))
|
||||
.Reverse();
|
||||
var result = new DistinguishedName();
|
||||
result.components.AddRange(dcComponents);
|
||||
return result;
|
||||
|
|
Loading…
Reference in New Issue