public void IndexReturnsCorrectCookieString() { var sut = new MeApiController(); var mockedHttpRequest = sut.GetMockHttpRequest(); sut.Index(); mockedHttpRequest.Verify(x => x.Cookies[".AspNet.ApplicationCookie"], Times.Once()); }
public async Task LoginReturnsCorrectCookieString() { var model = new LoginViewModel() { Email = "*****@*****.**", Password = "******" }; var mediator = new Mock<IMediator>(); var userManager = MockHelper.CreateUserManagerMock(); var signInManager = MockHelper.CreateSignInManagerMock(userManager); signInManager.Setup( x => x.PasswordSignInAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<bool>(), It.IsAny<bool>())) .ReturnsAsync(Microsoft.AspNetCore.Identity.SignInResult.Success); var sut = new MeApiController(userManager.Object, signInManager.Object, mediator.Object); var mockedHttpRequest = sut.GetMockHttpRequest(); await sut.Login(model); mockedHttpRequest.Verify(x => x.Cookies[".AspNet.ApplicationCookie"], Times.Once()); }