public async Task IndexShouldReturnsViewWithCorrectModel() { // Arrange var brands = DataHelper.GetBrandsCollection(); var adminBrandsService = new Mock <IAdminBrandsService>(); adminBrandsService .Setup(s => s.AllAsync()) .ReturnsAsync(brands); var controller = new BrandsController(adminBrandsService.Object, null); // Act var result = await controller.Index(); // Assert result.Should().NotBeNull(); result.Should().BeOfType <ViewResult>(); var viewName = result.As <ViewResult>().ViewName; viewName.Should().BeNull(); var model = result.As <ViewResult>().Model; var viewModel = model.As <BrandListingViewModel>(); viewModel.Should().NotBeNull(); }