public async Task CompanyInformation_ReturnsRedirectToActionResult_ForCompanyEqualNull() { //Arrange string name = "testName"; mockUserManager.Setup(s => s.FindByNameAsync(It.IsAny <string>())).ReturnsAsync(() => null); //Act var result = await _controller.CompanyInformation(name); //Assert var redirectToAction = Assert.IsType <RedirectToActionResult>(result); Assert.Equal("Error", redirectToAction.ActionName); Assert.Equal("Error", redirectToAction.ControllerName); mockLogger.Verify( x => x.Log( It.Is <LogLevel>(l => l == LogLevel.Warning), It.IsAny <EventId>(), It.Is <It.IsAnyType>((v, t) => true), It.IsAny <Exception>(), It.Is <Func <It.IsAnyType, Exception, string> >((v, t) => true))); }