public async Task ChangeNonExistingDay() { //Try to change day with id var controller = new CalendarController(unit.Context); int id = 1000; Day day = new Day { Id = id, Employee = unit.Employees.Get(1), DayType = unit.DayTypes.Get(1), Date = DateTime.Now }; var response = await controller.Put(id, day) as ObjectResult; Assert.AreEqual(404, response.StatusCode); }
public async Task ChangeDay() { //Try to change day with id 2 var controller = new CalendarController(unit.Context); int id = 2; Day day = new Day { Id = id, Employee = unit.Employees.Get(1), DayType = unit.DayTypes.Get(1), Date = DateTime.Now }; var response = await controller.Put(id, day) as ObjectResult; var value = response.Value as DayModel; Assert.AreEqual(200, response.StatusCode); Assert.AreEqual(1, value.Employee.Id);//id of the new day will be 3 }