NoteNullablePrimary.cs 839 B

12345678910111213141516171819202122232425262728293031323334
  1. using System;
  2. using Shouldly;
  3. namespace PetaPoco.Tests.Integration.Models
  4. {
  5. [TableName("Note")]
  6. [PrimaryKey("Id", AutoIncrement = true)]
  7. public class NoteNullablePrimary
  8. {
  9. public int? Id { get; set; }
  10. public DateTime CreatedOn { get; set; }
  11. public string Text { get; set; }
  12. public void ShouldBe(NoteNullablePrimary other)
  13. {
  14. Id.ShouldBe(other.Id);
  15. CreatedOn.ShouldBe(other.CreatedOn);
  16. Text.ShouldBe(other.Text);
  17. }
  18. public void ShouldNotBe(NoteNullablePrimary other, bool sameIds)
  19. {
  20. if (sameIds)
  21. Id.ShouldBe(other.Id);
  22. else
  23. Id.ShouldNotBe(other.Id);
  24. CreatedOn.ShouldNotBe(other.CreatedOn);
  25. Text.ShouldNotBe(other.Text);
  26. }
  27. }
  28. }