public void SearchOrdersByCarAndUserTest(string searchCar, string searchUser) { //Arrange var mockUow = new Mock <IUnitOfWork>(); mockUow.Setup(a => a.Orders.GetAll()).Returns(new List <Order>()); //Act var service = new RentService(mockUow.Object); var result = service.GetOrders(searchCar, searchUser); //Assert Assert.That(result, Is.TypeOf(typeof(List <OrderDTO>))); }
public void GetOrderByUserIdTest(string userId) { //Arrange var mockUow = new Mock <IUnitOfWork>(); mockUow.Setup(a => a.Orders.GetAll()).Returns(new List <Order>()); //Act var service = new RentService(mockUow.Object); var result = service.GetOrders(userId); //Assert Assert.That(result, Is.TypeOf(typeof(List <OrderDTO>))); }
public void GetOrderByUserIdValidationTest(string 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.GetOrders(id)); }