本文整理汇总了C#中AuthenticationService.Authenticate方法的典型用法代码示例。如果您正苦于以下问题:C# AuthenticationService.Authenticate方法的具体用法?C# AuthenticationService.Authenticate怎么用?C# AuthenticationService.Authenticate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AuthenticationService
的用法示例。
在下文中一共展示了AuthenticationService.Authenticate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: should_add_and_successfully_authenticate_the_first_user
public void should_add_and_successfully_authenticate_the_first_user()
{
var userRepository = new MemoryRepository<User>();
var authenticationService = new AuthenticationService(userRepository, new UserCreateService(userRepository));
authenticationService.Authenticate(Username, Password);
userRepository.Count().ShouldEqual(1);
}
示例2: should_successfully_authenticate_with_correct_credentials
public void should_successfully_authenticate_with_correct_credentials()
{
var authenticationService = new AuthenticationService(_userRepository, new UserCreateService(_userRepository));
var result = authenticationService.Authenticate(Username, Password);
result.ShouldNotBeNull();
result.Username.ToString().ShouldEqual(Username);
result.IsAdministrator.ShouldBeTrue();
}
示例3: Authenticate_WhenCalled_PublishesAuthenticationEvent
public async void Authenticate_WhenCalled_PublishesAuthenticationEvent()
{
//Arrange
var service = new AuthenticationService();
var eventAggregator = Mock.Create<IEventAggregator>();
Mock.Arrange(() => eventAggregator.Publish(Arg.IsAny<AuthenticationEvent>())).MustBeCalled();
service.TheEventAggregator = eventAggregator;
//Act
await service.Authenticate("UserName");
//Assert
Mock.Assert(service);
}
示例4: Authenticate
public Exception Authenticate(string userName, string userPassword, bool isIntegrated, string processPath)
{
try
{
var wse = new AuthenticationService();
wse.Credentials = GetCredentials(isIntegrated, userName, userPassword);
wse.Url = processPath + "Services/AuthenticationService.asmx";
if (isIntegrated && string.IsNullOrEmpty(userPassword))
userPassword = DEFAULT_PASSWORD_TEMPLATE;
TpServicePolicy.ApplyAutheticationTicket(wse, userName, userPassword);
wse.Authenticate();
}
catch (Exception exception)
{
return exception;
}
return null;
}
示例5: should_fail_to_authenticate_with_incorrect_credentials
public void should_fail_to_authenticate_with_incorrect_credentials()
{
var authenticationService = new AuthenticationService(_userRepository, new UserCreateService(_userRepository));
authenticationService.Authenticate(Username, "yada").ShouldBeNull();
}