public void Update_NotExistObject_ShouldReturnNotFound() { var offering3 = new Offering { Id = 3, Name = "name3", Departments = null }; mock.Setup(repo => repo.GetAllItems(null)).Returns(listItems.AsQueryable()); mock.Setup(repo => repo.Update(offering3)); var controller = new OfferingController(mockChild.Object, mock.Object); var result = controller.Update(offering3); Assert.IsAssignableFrom <ActionResult <Offering> >(result); Assert.IsType <NotFoundResult>(result.Result); }
public void Update_ValidObject_ShouldReturnUpdatedObject() { var offering3 = new Offering { Id = 1, Name = "name3", Departments = null }; mock.Setup(repo => repo.GetAllItems(null)).Returns(listItems.AsQueryable()); mock.Setup(repo => repo.Update(offering3)); var controller = new OfferingController(mockChild.Object, mock.Object); var result = controller.Update(offering3); Assert.IsAssignableFrom <ActionResult <Offering> >(result); Assert.Equal(offering3.Id, result.Value.Id); }