public void TestSqlLiteAcceptsComputedColButDoesntWork()
        {
            //SETUP
            var options = SqliteInMemory.CreateOptions <MyEntityComputedColDbContext>();

            using (var context = new MyEntityComputedColDbContext(options))
            {
                context.Database.EnsureCreated();

                //ATTEMPT
                context.Add(new MyEntity());
                var ex = Assert.Throws <DbUpdateException>(() => context.SaveChanges());

                //VERIFY
                Assert.StartsWith("SQLite Error 19: 'NOT NULL constraint failed:", ex.InnerException.Message);
            }
        }
Exemple #2
0
        public void TestInMemoryAcceptsComputedColButDoesntWork()
        {
            //SETUP
            var options = EfInMemory.CreateOptions <MyEntityComputedColDbContext>();

            using (var context = new MyEntityComputedColDbContext(options))
            {
                context.Database.EnsureCreated();

                //ATTEMPT
                context.Add(new MyEntity());
                context.SaveChanges();

                //VERIFY
                context.Set <MyEntity>().First().MyDateTime.ShouldEqual(new DateTime());
            }
        }