public async Task WhenPasswordSignInAsyncIsCalled_AndEverythingIsSetup_ThenASignInResultSucceededShouldBeReturnedAsync() { //arrange var userId = "bo8w3d32q9b98"; MemberSignInManager sut = CreateSut(); var fakeUser = new MemberIdentityUser(777) { UserName = "******", }; var password = "******"; var lockoutOnFailure = false; var isPersistent = true; _memberManager.Setup(x => x.GetUserIdAsync(It.IsAny <MemberIdentityUser>())).ReturnsAsync(userId); _memberManager.Setup(x => x.GetUserNameAsync(It.IsAny <MemberIdentityUser>())).ReturnsAsync(fakeUser.UserName); _memberManager.Setup(x => x.FindByNameAsync(It.IsAny <string>())).ReturnsAsync(fakeUser); _memberManager.Setup(x => x.CheckPasswordAsync(fakeUser, password)).ReturnsAsync(true); _memberManager.Setup(x => x.IsEmailConfirmedAsync(fakeUser)).ReturnsAsync(true); _memberManager.Setup(x => x.IsLockedOutAsync(fakeUser)).ReturnsAsync(false); //act SignInResult actual = await sut.PasswordSignInAsync(fakeUser, password, isPersistent, lockoutOnFailure); //assert Assert.IsTrue(actual.Succeeded); }
public async Task WhenPasswordSignInAsyncIsCalled_AndTheResultFails_ThenASignInFailedResultShouldBeReturnedAsync() { //arrange MemberSignInManager sut = CreateSut(); var fakeUser = new MemberIdentityUser(777) { UserName = "******", }; var password = "******"; var lockoutOnFailure = false; var isPersistent = true; //act SignInResult actual = await sut.PasswordSignInAsync(fakeUser, password, isPersistent, lockoutOnFailure); //assert Assert.IsFalse(actual.Succeeded); }