public Delivery(int reference, Producer producer, DeliveryKind kind, DateTimeOffset scheduledOn, ExpectedAddress address, Guid clientId, string clientName, IEnumerable <PurchaseOrder> purchaseOrders, int?position) { Id = Guid.NewGuid(); Status = DeliveryStatus.Waiting; Client = clientName; ClientId = clientId; Kind = kind; ScheduledOn = scheduledOn; Position = position; Address = address; ProducerId = producer.Id; Producer = producer.Name; Reference = reference; AddPurchaseOrders(purchaseOrders); }
public DeliveryMode(Guid id, DeliveryKind kind, Producer producer, bool available, DeliveryAddress address, IEnumerable <DeliveryHours> openingHours, string name, string description = null) { Id = id; Kind = kind; Description = description; Address = address; Producer = producer; ProducerId = producer.Id; Closings = new List <DeliveryClosing>(); DeliveryHours = new List <DeliveryHours>(); SetName(name); SetDeliveryHours(openingHours); SetAvailability(available); DomainEvents = new List <DomainEvent>(); }
public async Task Should_Return_No_Deliveries(string producerId, bool available, DeliveryKind kind) { var token = CancellationToken.None; _currentUserService.Setup(c => c.GetCurrentUserInfo()).Returns(Result <RequestUser> .Success(new RequestUser())); await _context.AddAsync(new DeliveryMode( Guid.NewGuid(), kind, new Producer(Guid.Parse("3b5c008bb6a24f5c8cc8258b9e33105f"), "prod1", "fa", "la", "*****@*****.**", new UserAddress("x", null, "x", "x", CountryIsoCode.FR, null)), available, new DeliveryAddress("x", null, "x", "x", CountryIsoCode.FR, null, null), new List <DeliveryHours> { new DeliveryHours(DayOfWeek.Wednesday, TimeSpan.FromHours(8), TimeSpan.FromHours(12)) }, "delivery1"), token); await _context.SaveChangesAsync(token); //test var results = await _queries.GetNextDeliveries( new List <Guid> { Guid.Parse(producerId) }, new List <DeliveryKind> { DeliveryKind.Farm }, // DateTime.UtcNow, _context, token); //assert results.Should().NotBeNull().And.BeEmpty(); }
public void SetKind(DeliveryKind kind) { Kind = kind; }