public void SetTest()
        {
            var Id = Guid.NewGuid();
            using (var C = Tonic.DbContextMock.Persistent<Db>(Id))
            {
                var Customer = new Customer
                {
                    Name = "Rafa",
                    Id = 10,
                    Email = "*****@*****.**"
                };

                //Add two customers
                C.Customer.Add(Customer);
                C.Set<Customer>().Add(Customer);

                C.SaveChanges();
            }

            //New instance should be empty
            using (var C = Tonic.DbContextMock.Persistent<Db>(Id))
            {
                Assert.AreEqual(2, C.Customer.Count());
                Assert.AreEqual(2, C.Set<Customer>().Count());
                //The set instance should be the same:
                Assert.AreEqual(C.Set<Customer>(), C.Customer);
                Assert.AreEqual(C.Set<Customer>(), C.Set<Customer>());
                Assert.AreEqual(C.Set<Customer>().Local, C.Set(typeof(Customer)).Local);
                Assert.AreEqual(typeof(Customer), C.Set(typeof(Customer)).ElementType);
                Assert.AreEqual(C.Customer, C.Customer);

            }
        }
        public async Task FindTest()
        {
            using (var c = Tonic.DbContextMock.Transient<Db>())
            {
                var Customer = new Customer
                {
                    Name = "Rafa",
                    Id = 10,
                    Email = "*****@*****.**"
                };
                c.Customer.Add(Customer);

                Assert.IsNull(c.Customer.Find(1));
                Assert.IsNull(c.Product.Find(1));

                Assert.IsNotNull(c.Customer.Find(10));
                Assert.AreEqual("Rafa", (await c.Customer.FindAsync(10)).Name);
                Assert.AreEqual("Rafa", (await c.Set<Customer>().FindAsync(10)).Name);
                Assert.AreEqual("Rafa", ((Customer)(await c.Set(typeof(Customer)).FindAsync(10))).Name);
            }
        }
        public void PersistentTest()
        {
            var DbId = Guid.NewGuid();

            var X = Tonic.DbContextMock.Persistent<Db>(DbId);

            var Customer = new Customer
            {
                Name = "Rafa",
                Id = 10,
                Email = "*****@*****.**"
            };

            X.Customer.Add(Customer);

            var Ret = X.Customer.ToList();
            Assert.AreEqual(Customer, Ret[0]);

            //Create a new context with the same database id, the data should be the same
            var Y = Tonic.DbContextMock.Persistent<Db>(DbId);

            Assert.AreEqual(Customer, Y.Customer.First());
        }
        public void TransientTest()
        {
            using (var C = Tonic.DbContextMock.Transient<Db>())
            {
                var Customer = new Customer
                {
                    Name = "Rafa",
                    Id = 10,
                    Email = "*****@*****.**"
                };

                C.Customer.Add(Customer);
            }

            //New instance should be empty
            using (var C = Tonic.DbContextMock.Transient<Db>())
            {
                Assert.IsFalse(C.Customer.Any());
            }
        }