public void Index() { // Arrange CalculatorController controller = new CalculatorController(); // Act ViewResult result = controller.Index() as ViewResult; // Assert Assert.IsNotNull(result); }
public void Calculator_AddNegativeValue_GetView() { // Arrange CalculatorModel calculateModel = new CalculatorModel(); calculateModel.number = 10; ActionResult result = null; // Act var validationResult = Validator.TryValidateObject(calculateModel, new ValidationContext(calculateModel, null, null), null, true); Assert.IsTrue(validationResult); CalculatorController calculateCnt = new CalculatorController(); result = calculateCnt.Calculate(calculateModel); ViewResult viewResult = (ViewResult)result; calculateModel = (CalculatorModel)viewResult.Model; Assert.IsNotNull(calculateModel.evenNumbers); }