示例#1
0
        public void CanGetForeignKeyPropertyName()
        {
            var context          = new ECommerceDataContext();
            var auditableContext = context as IAuditableContext;
            var propertyName     = auditableContext.GetForeignKeyPropertyName(typeof(Promotion), typeof(Product));

            Assert.AreEqual("ProductId", propertyName);
        }
示例#2
0
        public void CanGetPrimaryKeyPropertyFromEntity()
        {
            var context = new ECommerceDataContext();

            var auditableContext = context as IAuditableContext;
            var pi = auditableContext.GetPrimaryKeyProperty(typeof(Product));

            Assert.AreEqual("Id", pi.Name);
        }
示例#3
0
        public void AuditsInsertedRecords()
        {
            var context = new ECommerceDataContext();
            var product = new Product
            {
                CategoryId  = 1,
                ProductName = "Test"
            };

            context.Products.InsertOnSubmit(product);
            context.SubmitChanges();

            Assert.AreEqual(1, context.AuditRecords.Count());
        }