public void GetOrderTest(int?id) { //Arrange var mockUow = new Mock <IUnitOfWork>(); mockUow.Setup(a => a.Orders.Get(It.IsAny <int>())).Returns(new Order()); //Act var service = new RentService(mockUow.Object); var result = service.GetOrder(id); //Assert Assert.That(result, Is.TypeOf(typeof(OrderDTO))); }
public void GetOrderValidationTest(int?id) { //Arrange var mockUow = new Mock <IUnitOfWork>(); mockUow.Setup(a => a.Orders.Get(It.IsAny <int>())).Returns((Order)null); //Act var service = new RentService(mockUow.Object); //Assert Assert.Throws <ValidationException>( () => service.GetOrder(id)); }