Exemple #1
0
        public void SelectAnonymous()
        {
            DataMigrationHelper.AddEntity <Users, long>(DbAccess, 5, f => f.UserName = "******");
            var usersUsernameAnonymouses = DbAccess.Select <Users_UsernameAnonymous>();

            Assert.That(usersUsernameAnonymouses,
                        Is.All.Property(UsersMeta.ContentName).Not.Null.And.Not.EqualTo("Test"));
        }
        public void AddGenericTest(Type type)
        {
            var tableName = DbAccess.Config.GetOrCreateClassInfoCache(type).TableName;

            Assert.That(() => DataMigrationHelper.ClearDb(DbAccess), Throws.Nothing);
            Assert.That(() => DbAccess.Database.Run(s => s.GetSkalar("SELECT COUNT(1) FROM " + tableName)), Is.Zero);
            Assert.That(DataMigrationHelper.AddEntity(DbAccess, 200, type), Is.Not.Empty.And.Unique);
            Assert.That(() => DbAccess.Database.Run(s => s.GetSkalar("SELECT COUNT(1) FROM " + tableName)),
                        Is.EqualTo(200));
            Assert.That(DataMigrationHelper.AddEntity(DbAccess, 200, type), Is.Not.Empty.And.Unique);
            Assert.That(() => DbAccess.Database.Run(s => s.GetSkalar("SELECT COUNT(1) FROM " + tableName)),
                        Is.EqualTo(400));
        }