public void AddProductToOrder_AddsProductToOrder_WhenHasAvailableOnInventory() { // arrange _orderDomainService = new OrdersDomainService(_inventoryRepository.Object); var product = new Product() { Id = 1, Brand = "BrandA", Category = "CategoryA", Name = "Prod Name", Price = 100 }; var order = new Order(new User() { Id = 1, FirstName = "FirstName", LastName = "LastName" }); _inventoryRepository.Setup(r => r.GetById(It.IsAny <int>())).Returns(() => new Inventory() { Quantity = 1, Product = new Product() { Id = 1 } }); // act _orderDomainService.AddProductToOrder(product, order); // assert Assert.IsTrue(order.Products.Count == 1); Assert.AreEqual(product, order.Products.First()); }
public GetOrderByIdQueryHandler(IDbContext context, IOrdersDomainService ordersDomainService, IPermissionsManager permissionsManager) { _context = context; _ordersDomainService = ordersDomainService; _permissionsManager = permissionsManager; }
public OrdersService( IOrdersRepository orderRepository, IProductsRepository productRepository, IUsersRepository userRepository, IOrdersDomainService orderDomainService, IStockDispatcher stockDispatcher) { _orderRepository = orderRepository; _productRepository = productRepository; _userRepository = userRepository; _orderDomainService = orderDomainService; _stockDispatcher = stockDispatcher; }
public GetAllOrdersQueryHandler(IDbContext context, IOrdersDomainService ordersDomainService) { _context = context; _ordersDomainService = ordersDomainService; }