You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.1 KiB

7 years ago
  1. using System;
  2. using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
  3. namespace UnitTest.Ordering
  4. {
  5. public class AddressBuilder
  6. {
  7. public Address Build()
  8. {
  9. return new Address("street", "city", "state", "country", "zipcode");
  10. }
  11. }
  12. public class OrderBuilder
  13. {
  14. private readonly Order order;
  15. public OrderBuilder(Address address)
  16. {
  17. order = new Order(
  18. "userId",
  19. address,
  20. cardTypeId:5,
  21. cardNumber:"12",
  22. cardSecurityNumber:"123",
  23. cardHolderName:"name",
  24. cardExpiration:DateTime.UtcNow);
  25. }
  26. public OrderBuilder AddOne(
  27. int productId,
  28. string productName,
  29. decimal unitPrice,
  30. decimal discount,
  31. string pictureUrl,
  32. int units = 1)
  33. {
  34. order.AddOrderItem(productId, productName, unitPrice, discount, pictureUrl, units);
  35. return this;
  36. }
  37. public Order Build()
  38. {
  39. return order;
  40. }
  41. }
  42. }