public void RationControllerPostEditRation() { PacketDetail packetDetail = new PacketDetail(); packetDetail.Id = Convert.ToInt32(TestContext.DataRow["Id"]); packetDetail.PacketContent = Convert.ToString(TestContext.DataRow["PacketContent"]); packetDetail.PacketTypeId = Convert.ToString(TestContext.DataRow["PacketTypeId"]); if (Convert.ToString(TestContext.DataRow["PacketTypeId"]) == "1") { packetDetail.Calories = Convert.ToInt32(TestContext.DataRow["Calories"]); } if (Convert.ToString(TestContext.DataRow["PacketTypeId"]) == "1") { packetDetail.Datestart = Convert.ToString(TestContext.DataRow["ExpiryDate"]); packetDetail.LitersQty = Convert.ToInt32(0); } if (Convert.ToString(TestContext.DataRow["PacketTypeId"]) == "2") { packetDetail.LitersQty = Convert.ToInt32(TestContext.DataRow["QuantityOfLtr"]); } DataContext dataContext = new DataContext(); PacketDetailRepository packetDetailRepository = new PacketDetailRepository(dataContext); PacketTypeRepository packetTypeRepository = new PacketTypeRepository(dataContext); ErrorLogsRepository errorLogsRepository = new ErrorLogsRepository(dataContext); RationController rationController = new RationController(packetDetailRepository, packetTypeRepository, errorLogsRepository); ViewResult result = rationController.EditRation(packetDetail) as ViewResult; // Assert Assert.IsNull(result); }
public void RationControllerGetEditRation() { int PacketId = 1; DataContext dataContext = new DataContext(); PacketDetailRepository packetDetailRepository = new PacketDetailRepository(dataContext); PacketTypeRepository packetTypeRepository = new PacketTypeRepository(dataContext); ErrorLogsRepository errorLogsRepository = new ErrorLogsRepository(dataContext); RationController rationController = new RationController(packetDetailRepository, packetTypeRepository, errorLogsRepository); ViewResult result = rationController.EditRation(PacketId) as ViewResult; // Assert Assert.IsNotNull(result); }