OrderLine.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using Shouldly;
  2. namespace PetaPoco.Tests.Unit.Models
  3. {
  4. [TableName("OrderLines")]
  5. [PrimaryKey("Id")]
  6. public class OrderLine
  7. {
  8. [Column]
  9. public int Id { get; set; }
  10. [Column]
  11. public int OrderId { get; set; }
  12. [Column(Name = "Qty")]
  13. public short Quantity { get; set; }
  14. [Column]
  15. public decimal SellPrice { get; set; }
  16. [ResultColumn]
  17. public decimal Total { get; set; }
  18. public void ShouldBe(OrderLine other)
  19. {
  20. Id.ShouldBe(other.Id);
  21. OrderId.ShouldBe(other.OrderId);
  22. Quantity.ShouldBe(other.Quantity);
  23. SellPrice.ShouldBe(other.SellPrice);
  24. }
  25. public void ShouldNotBe(OrderLine other, bool sameIds)
  26. {
  27. if (sameIds)
  28. {
  29. Id.ShouldBe(other.Id);
  30. OrderId.ShouldBe(other.OrderId);
  31. }
  32. else
  33. {
  34. Id.ShouldNotBe(other.Id);
  35. OrderId.ShouldNotBe(other.OrderId);
  36. }
  37. Quantity.ShouldNotBe(other.Quantity);
  38. SellPrice.ShouldNotBe(other.SellPrice);
  39. }
  40. }
  41. }