public IHttpActionResult Delete(Guid id) { bool result = _ordersManager.Delete(id); if (result) { return(Ok()); } return(NotFound()); }
[TestCase(false)] // passing customer id public void Delete_WhenCalled_ReturnsBoolean(bool isEmptyGuid) { //Arrange _unitOfWork.Setup(x => x.RepositoryFor <Entities.Order>().Delete(Guid.NewGuid())).Returns(!isEmptyGuid); //Act bool func() => _ordersManager.Delete(isEmptyGuid ? Guid.Empty : Guid.NewGuid()); //Assert if (isEmptyGuid) { Assert.That(() => func(), Throws.TypeOf <ArgumentNullException>()); } else { Assert.IsFalse(func()); } }