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.

48 lines
1.2 KiB

7 years ago
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. "fakeName",
  20. address,
  21. cardTypeId:5,
  22. cardNumber:"12",
  23. cardSecurityNumber:"123",
  24. cardHolderName:"name",
  25. cardExpiration:DateTime.UtcNow);
  26. }
  27. public OrderBuilder AddOne(
  28. int productId,
  29. string productName,
  30. decimal unitPrice,
  31. decimal discount,
  32. string pictureUrl,
  33. int units = 1)
  34. {
  35. order.AddOrderItem(productId, productName, unitPrice, discount, pictureUrl, units);
  36. return this;
  37. }
  38. public Order Build()
  39. {
  40. return order;
  41. }
  42. }
  43. }