예제 #1
0
        public async Task LogOffRedirectsToCorrectActionAndController()
        {
            var signInManager = CreateSignInManagerMock(CreateUserManagerMock());
            signInManager.Setup(x => x.SignOutAsync()).Returns(() => Task.FromResult(It.IsAny<Task>()));

            var sut = new AccountController(null, signInManager.Object, null, null, null);
            var result = await sut.LogOff() as RedirectToActionResult;

            Assert.Equal(result.ActionName, nameof(HomeController.Index));
            Assert.Equal(result.ControllerName, "Home");
        }
예제 #2
0
        public async Task LogOffInvokesSignOutAsync()
        {
            var signInManager = CreateSignInManagerMock(CreateUserManagerMock());

            var sut = new AccountController(null, signInManager.Object, null, null, null);
            await sut.LogOff();

            signInManager.Verify(x => x.SignOutAsync(), Times.Once);
        }