Person.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System;
  2. using Shouldly;
  3. namespace PetaPoco.Tests.Integration.Models
  4. {
  5. [TableName("People")]
  6. [PrimaryKey("Id", AutoIncrement = false)]
  7. public class Person
  8. {
  9. [Column]
  10. public Guid Id { get; set; }
  11. [Column(Name = "FullName")]
  12. public string Name { get; set; }
  13. [Column]
  14. public long Age { get; set; }
  15. [Column]
  16. public int Height { get; set; }
  17. [Column]
  18. public DateTime? Dob { get; set; }
  19. [Ignore]
  20. public string NameAndAge => $"{Name} is of {Age}";
  21. public void ShouldBe(Person other)
  22. {
  23. Id.ShouldBe(other.Id);
  24. Name.ShouldBe(other.Name);
  25. Age.ShouldBe(other.Age);
  26. Height.ShouldBe(other.Height);
  27. Dob.ShouldBe(other.Dob);
  28. }
  29. public void ShouldNotBe(Person other, bool sameId)
  30. {
  31. if (sameId)
  32. {
  33. Id.ShouldBe(other.Id);
  34. }
  35. else
  36. {
  37. Id.ShouldNotBe(other.Id);
  38. }
  39. Name.ShouldNotBe(other.Name);
  40. Age.ShouldNotBe(other.Age);
  41. Height.ShouldNotBe(other.Height);
  42. Dob.ShouldNotBe(other.Dob);
  43. }
  44. }
  45. }