public void DeleteOrderValidationTest(int?id) { //Arrange var mockUow = new Mock <IUnitOfWork>(); mockUow.Setup(a => a.Orders.Get(-1)).Returns((Order)null); //Act var service = new RentService(mockUow.Object); //Assert Assert.Throws <ValidationException>( () => service.DeleteOrder(id)); }