Exemplo n.º 1
0
        public void InsertAutoIncrement()
        {
            var person = new Person { Id = Guid.NewGuid(), Name = "PetaPoco", Dob = new DateTime(2011, 1, 1), Age = (DateTime.Now.Year - 2011), Height = 242 };
            DB.Insert(person);

            // Create the order
            var order = new Order { PersonId = person.Id, PoNumber = "PETAPOCO", Status = OrderStatus.Pending, CreatedBy = "Office PetaPoco", CreatedOn = new DateTime(1948, 1, 11, 4, 2, 4, DateTimeKind.Utc) };

            // Tell PetaPoco to insert it
            var id = DB.Insert(order);

            // PetaPoco updates the POCO's ID for us, see
            id.ShouldBe(order.Id);

            // Get a clone/copy from the DB
            var clone = DB.Single<Order>(id);

            // See, they're are the same
            clone.ShouldBe(order);

            // But, they're not not reference equals as PetaPoco doesn't cache because it's a MircoORM.
            order.Equals(clone).ShouldBeFalse();
        }
Exemplo n.º 2
0
 public void ShouldBe(Order other)
 {
     Id.ShouldBe(other.Id);
     PersonId.ShouldBe(other.PersonId);
     PoNumber.ShouldBe(other.PoNumber);
     Status.ShouldBe(other.Status);
     CreatedOn.ShouldBe(other.CreatedOn);
     CreatedBy.ShouldBe(other.CreatedBy);
 }