public void LoginShouldTriggerLoginEventIfUserIsLoggedIn(FakeMembershipUser user, [Frozen]IAccountTrackerService accountTrackerService, AuthenticationProvider authenticationProvider, AccountRepository repo) { authenticationProvider.Login(@"somedomain\John", Arg.Any<string>(), Arg.Any<bool>()).Returns(true); var context = new FakeSiteContext(new StringDictionary { { "domain", "somedomain" } }); using (new Switcher<Domain, Domain>(new Domain("somedomain"))) { using (new AuthenticationSwitcher(authenticationProvider)) { var loginResult = repo.Login("John", "somepassword"); accountTrackerService.Received(1).TrackLogin(); } } }
public void LoginShouldReturnTrueIfUserIsLoggedIn(FakeMembershipUser user, AuthenticationProvider authenticationProvider, AccountRepository repo) { authenticationProvider.Login(@"somedomain\John", Arg.Any<string>(), Arg.Any<bool>()).Returns(true); var context = new FakeSiteContext(new StringDictionary { { "domain", "somedomain" } }); using (new Switcher<Domain, Domain>(new Domain("somedomain"))) { using (new AuthenticationSwitcher(authenticationProvider)) { var loginResult = repo.Login("John", "somepassword"); loginResult.Should().BeTrue(); } } }