public async void ReturnCorrectView() { var result = await sut.Index(); var vr = Assert.IsType <ViewResult>(result); Assert.Equal("Index", vr.ViewName); }
public void Index_LoadingPageWithTag() { var controller = new ListingController(queryService.Object, null); var viewResult = controller.Index(tag: "Tag1"); Assert.IsNotNull(viewResult); Assert.IsInstanceOfType(viewResult, typeof(ViewResult)); var model = ((ViewResult)viewResult).Model as ListingViewModel; Assert.IsFalse(string.IsNullOrEmpty(model.Tag)); Assert.IsTrue(model.Questions.Count == 1); }
public void Instance_Test_Index() { //Act var result = instance.Index(); //Assert Assert.IsNotNull(result, "View not found"); Assert.IsInstanceOf <ActionResult>(result, "View is not ActionResult"); var viewResult = result as ViewResult; Assert.IsNotNull(viewResult, "View is not ViewResult"); Assert.IsNotNull(viewResult.Model, "Model is not loaded"); Assert.IsInstanceOf <IEnumerable <ProductListing> >(viewResult.Model, "Model nolt of productlisting"); service.VerifyAll(); }