public async Task AuthenticationEventArgsProvideResult() { var service = new MockIdentityService(); service.AuthenticationRequested += (sender, args) => { }; await service.AuthenticateAsync(); }
public void AuthenticationEventHandlerRequired() { var service = new MockIdentityService(); service.AuthenticateAsync(); }
public async Task SuccessfulAuthenticationRaisesIsAuthenticationRequired() { var service = new MockIdentityService(); service.AuthenticationRequested += (sender, args) => args.Success("Jenny"); bool wasEventRaised = false; service.IsAuthenticatedChanged += (sender, args) => wasEventRaised = true; await service.AuthenticateAsync(); Assert.IsTrue(wasEventRaised); }
public async Task FailedAuthentication() { var service = new MockIdentityService(); service.AuthenticationRequested += (sender, args) => args.Fail(); var result = await service.AuthenticateAsync(); Assert.IsFalse(result); Assert.IsFalse(service.IsAuthenticated); Assert.IsNull(service.CurrentUserId); }
public async Task SuccessfulAuthentication() { var service = new MockIdentityService(); service.AuthenticationRequested += (sender, args) => args.Success("Johnny"); var result = await service.AuthenticateAsync(); Assert.IsTrue(result); Assert.IsTrue(service.IsAuthenticated); Assert.AreEqual("Johnny", service.CurrentUserId); }