public void ReturnNotFoundIfIdDoesntExist() { var model = new ContactEditModel { Id = 4, FirstName = "Han", LastName = "Solo" }; var contactsController = new ContactsController(_mockDbContext.Object); var result = contactsController.Put(model.Id, model).Result; Assert.IsInstanceOfType(result, typeof(NotFoundResult)); }
public void ReturnBadRequestIfIdInParameterAndModelDoNotMatch() { var model = new ContactEditModel { Id = 3, FirstName = "Darth", LastName = "Kitty" }; var contactsController = new ContactsController(_mockDbContext.Object); var result = contactsController.Put(0, model).Result; Assert.IsInstanceOfType(result, typeof(BadRequestResult)); }