public static Mock <IShippingService> CreateMockShippingService(ShippingSlip shippingSlip) { var mockShippingService = new Mock <IShippingService>(); mockShippingService.Setup(shippingService => shippingService.GenerateShippingSlipAsync(It.IsAny <int>(), It.IsAny <IEnumerable <IPurchaseItem> >())).Returns(Task.FromResult(shippingSlip)); return(mockShippingService); }
public ShippingSlipLine(ShippingSlip shipping, Product product, int quantity) { ShippingSlip = shipping ?? throw new ArgumentNullException(nameof(shipping)); ShippingSlipId = shipping.Id; Product = product ?? throw new ArgumentNullException(nameof(product)); ProductId = product.Id; Quantity = quantity; }
public void CreateShippingSlip(IProduct product, Customer customer) { var shippingSlip = new ShippingSlip { Customer = customer, Product = product, ShippingAddress = customer.ShippingAddress }; _repository.SaveShippingSlip(shippingSlip); }
public async Task Handle(OrderedPhysicalProductDomainEvent orderEvent, CancellationToken cancellationToken) { if (!orderEvent.Order.Lines.Any(x => x.Product.Type == ProductType.Book || x.Product.Type == ProductType.Video)) { return; } ShippingSlip shippingSlip = new ShippingSlip(orderEvent.CustomerId, "Street 1, 123", orderEvent.Order); _shippingSlipRepository.Add(shippingSlip); await _shippingSlipRepository.UnitOfWork.SaveEntitiesAsync(cancellationToken); }
public async Task ProcessAsync(PurchaseOrder order, PurchaseOrderLine line) { if (order == null) { throw new ArgumentNullException(nameof(order)); } if (line == null) { throw new ArgumentNullException(nameof(line)); } order.Validate(); if (!CanProcess(line.Product)) { throw new NotSupportedException(nameof(line.Product)); } await Task.Factory.StartNew(() => { ShippingSlip shippingSlip = new ShippingSlip(order.OrderNumber); order.ShippingSlip = shippingSlip; }); }
public IPOModifier CreateShippingSlip() { Slip = new ShippingSlip(); return(this); }
public ShippingSlip Update(ShippingSlip ShippingSlip) { return(_context.ShippingSlips .Update(ShippingSlip) .Entity); }
public ShippingSlip Add(ShippingSlip ShippingSlip) { return(_context.ShippingSlips .Add(ShippingSlip) .Entity); }
public void SaveShippingSlip(ShippingSlip shippingSlip) { shippingSlips.Add(shippingSlip); }