Skip to content

Commit

Permalink
Fix instantiating PrincipleContext with Domain type (dotnet/corefx#24122
Browse files Browse the repository at this point in the history
)

* Fix instantiating PrincipleContext  with Domain type

* Enhancement


Commit migrated from dotnet/corefx@adde551
  • Loading branch information
tarekgh authored Sep 19, 2017
1 parent acc3fbe commit fcfa833
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,11 @@ public void Ctor_InvalidContexType_ThrowsInvalidEnumArgumentException(ContextTyp
[Fact]
public void Ctor_DomainContextType_ThrowsPrincipalServerDownException()
{
Assert.Throws<PrincipalServerDownException>(() => new PrincipalContext(ContextType.Domain));
if (Environment.MachineName.Equals(Environment.UserDomainName, StringComparison.OrdinalIgnoreCase))
{
// The machine is not connected to a domain. we expect PrincipalContext(ContextType.Domain) to throw
Assert.Throws<PrincipalServerDownException>(() => new PrincipalContext(ContextType.Domain));
}
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,11 @@ public class SearchResultEntry
{
private DirectoryControl[] _resultControls = null;

internal SearchResultEntry(string dn) => DistinguishedName = dn;
internal SearchResultEntry(string dn) : this(dn, new SearchResultAttributeCollection()) {}

internal SearchResultEntry(string dn, SearchResultAttributeCollection attrs) : this(dn)
internal SearchResultEntry(string dn, SearchResultAttributeCollection attrs)
{
DistinguishedName = dn;
Attributes = attrs;
}

Expand Down

0 comments on commit fcfa833

Please sign in to comment.