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