public void GetUserNameReturnsName() { LoginRequest credentials = new LoginRequest(userName); ActiveDirectoryAuthentication authentication = new ActiveDirectoryAuthentication(); string result = authentication.GetUserName(credentials); Assert.AreEqual(userName, result); }
public void TestMissingUserName() { //todo pass in a stub/mock ldap service so we can test ActiveDirectoryAuthentication authentication = new ActiveDirectoryAuthentication("janedoe",null); LoginRequest credentials = new LoginRequest(); bool isValid = authentication.Authenticate(credentials); Assert.IsFalse(isValid); }
public void GetDisplayNameReturnsDisplayName() { string displayName = "John Doe"; LoginRequest credentials = new LoginRequest(userName); ActiveDirectoryAuthentication authentication = new ActiveDirectoryAuthentication(); authentication.DomainName = domainName; string result = authentication.GetDisplayName(credentials); Assert.AreEqual(displayName, result); }
public void GetSetAllProperties() { ActiveDirectoryAuthentication authentication = new ActiveDirectoryAuthentication(); authentication.UserName = userName; Assert.AreEqual(userName, authentication.UserName, "UserName not correctly set"); Assert.AreEqual(userName, authentication.Identifier, "Identifier not correctly set"); authentication.DomainName = domainName; Assert.AreEqual(domainName, authentication.DomainName, "DomainName not correctly set"); }
public void TestValidUserName() { //todo pass in a stub/mock ldap service so we can test ActiveDirectoryAuthentication authentication = new ActiveDirectoryAuthentication(userName, null); authentication.DomainName = domainName; LoginRequest credentials = new LoginRequest(userName); bool isValid = authentication.Authenticate(credentials); Assert.IsTrue(isValid); }