当前位置: 首页>>代码示例>>C#>>正文


C# AuthenticationService.Authenticate方法代码示例

本文整理汇总了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);
 }
开发者ID:mikeobrien,项目名称:volta,代码行数:7,代码来源:AuthenticationServiceTests.cs

示例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();
 }
开发者ID:mikeobrien,项目名称:volta,代码行数:8,代码来源:AuthenticationServiceTests.cs

示例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);
        }
开发者ID:mparsin,项目名称:Elements,代码行数:15,代码来源:AuthenticationServiceTests.cs

示例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;
		}
开发者ID:TargetProcess,项目名称:Tp.TrayUtility,代码行数:21,代码来源:TpAuthenticationManager.cs

示例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();
 }
开发者ID:mikeobrien,项目名称:volta,代码行数:5,代码来源:AuthenticationServiceTests.cs


注:本文中的AuthenticationService.Authenticate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。