public void SampleController_IndexTest() { SampleController sampleController = new SampleController(); var result = sampleController.Index() as ViewResult; Assert.AreEqual("Index", result.ViewName); }
public void TestMethod1() { var controller = new SampleController(); var result = controller.Index() as ViewResult; Assert.AreEqual("Index", result.ViewName); }
public void Index_WhenGetAllExistedData_ReturnsViewWithSamples() { //Arrange var sampleDTOs = _sampleService.Setup(s => s.GetAll()).Returns(new List <SampleDTO>()); var sampleEntries = _sampleService.Setup(s => s.GetSampleEntriesAmout(CurrentUser.IsAdmin)).Returns(1); _sampleController = new SampleController(_sampleService.Object, null); //Act ViewResult result = _sampleController.Index() as ViewResult; //Assert Assert.IsInstanceOf <ViewResult>(result); Assert.That(result.ViewName, Is.EqualTo("samples")); //Assert.IsNotNull(result.Model); //Assert.That(result.Model, Is.EqualTo(sampleDtos)); }