public void TestThatCanValidateTokenReturnsFalseWhenSecurityTokenIsNotUserNameSecurityToken(string certificateSubjectName) { var userNamePasswordValidatorMock = MockRepository.GenerateMock <UserNamePasswordValidator>(); var identityBuilderMock = MockRepository.GenerateMock <IIdentityBuilder>(); var certificateSecurityToken = new X509SecurityToken(TestHelper.GetCertificate(certificateSubjectName)); var userNameAsMailAddressSecurityTokenAuthenticator = new UserNameAsMailAddressSecurityTokenAuthenticator(userNamePasswordValidatorMock, identityBuilderMock); Assert.That(userNameAsMailAddressSecurityTokenAuthenticator, Is.Not.Null); var result = userNameAsMailAddressSecurityTokenAuthenticator.CanValidateToken(certificateSecurityToken); Assert.That(result, Is.Not.Null); }
public void TestThatCanValidateTokenReturnsTrueWhenSecurityTokenIsUserNameSecurityToken() { var fixture = new Fixture(); var userNamePasswordValidatorMock = MockRepository.GenerateMock <UserNamePasswordValidator>(); var identityBuilderMock = MockRepository.GenerateMock <IIdentityBuilder>(); var userNameSecurityToken = new UserNameSecurityToken(fixture.Create <string>(), fixture.Create <string>()); var userNameAsMailAddressSecurityTokenAuthenticator = new UserNameAsMailAddressSecurityTokenAuthenticator(userNamePasswordValidatorMock, identityBuilderMock); Assert.That(userNameAsMailAddressSecurityTokenAuthenticator, Is.Not.Null); var result = userNameAsMailAddressSecurityTokenAuthenticator.CanValidateToken(userNameSecurityToken); Assert.That(result, Is.Not.Null); }