Order.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using System;
  2. using System.Collections.Generic;
  3. using Shouldly;
  4. namespace PetaPoco.Tests.Integration.Models
  5. {
  6. [ExplicitColumns]
  7. [TableName("Orders")]
  8. [PrimaryKey("Id")]
  9. public class Order
  10. {
  11. [Column]
  12. public int Id { get; set; }
  13. [Column]
  14. public Guid PersonId { get; set; }
  15. [Column]
  16. public string PoNumber { get; set; }
  17. [Column]
  18. public DateTime CreatedOn { get; set; }
  19. [Column]
  20. public string CreatedBy { get; set; }
  21. [Column("OrderStatus")]
  22. public OrderStatus Status { get; set; }
  23. public Person Person { get; set; }
  24. public List<OrderLine> OrderLines { get; set; }
  25. public void ShouldBe(Order other)
  26. {
  27. Id.ShouldBe(other.Id);
  28. PersonId.ShouldBe(other.PersonId);
  29. PoNumber.ShouldBe(other.PoNumber);
  30. Status.ShouldBe(other.Status);
  31. CreatedOn.ShouldBe(other.CreatedOn);
  32. CreatedBy.ShouldBe(other.CreatedBy);
  33. }
  34. public void ShouldNotBe(Order other, bool sameIds)
  35. {
  36. if (sameIds)
  37. {
  38. Id.ShouldBe(other.Id);
  39. PersonId.ShouldBe(other.PersonId);
  40. }
  41. else
  42. {
  43. Id.ShouldNotBe(other.Id);
  44. PersonId.ShouldNotBe(other.PersonId);
  45. }
  46. PoNumber.ShouldNotBe(other.PoNumber);
  47. Status.ShouldNotBe(other.Status);
  48. CreatedOn.ShouldNotBe(other.CreatedOn);
  49. CreatedBy.ShouldNotBe(other.CreatedBy);
  50. }
  51. }
  52. }