public void GenerateReciprocalsTest() { var controller = new CrossPlanningController(mockRepo.Object); var response = controller.GenerateReciprocals(DateTime.Now.Year.ToString(), 3) as JsonResult; Assert.IsNotNull(response); dynamic json = response.Data; Assert.AreEqual("All reciprocals already created", json.Message); }
public void IndexByValidYearTest() { var Year = "2017"; var controller = new CrossPlanningController(mockRepo.Object); var response = controller.Index(Year, 3) as ViewResult; Assert.IsNotNull(response); Assert.IsNotNull(response.Model); Assert.IsNotNull(response.Model as CrossPlanIndexViewModel); var actual = response.Model as CrossPlanIndexViewModel; Assert.IsNotNull(actual.CurrentYear = "2017"); }
public void AddRowTest() { var controller = new CrossPlanningController(mockRepo.Object); var response = controller.AddRow(DateTime.Now.Year.ToString(), 3); Assert.IsNotNull(response as PartialViewResult); var responseView = response as PartialViewResult; Assert.IsNotNull(responseView.Model as CrossPlanViewModel); var model = responseView.Model as CrossPlanViewModel; Assert.AreEqual(model.Year, DateTime.Now.Year.ToString()); Assert.AreEqual(model.GenusId, 3); Assert.AreEqual(model.DateCreated.Day, DateTime.Now.Day); }