public void AddImagesTest() { Assert.That(() => DataMigrationHelper.ClearDb(DbAccess), Throws.Nothing); Assert.That(() => DbAccess.Database.Run(s => s.GetSkalar("SELECT COUNT(1) FROM " + ImageMeta.TableName)), Is.Zero); Assert.That(DataMigrationHelper.AddImages(200, DbAccess), Is.Not.Empty.And.Unique); Assert.That(() => DbAccess.Database.Run(s => s.GetSkalar("SELECT COUNT(1) FROM " + ImageMeta.TableName)), Is.EqualTo(200)); Assert.That(DataMigrationHelper.AddImages(200, DbAccess), Is.Not.Empty.And.Unique); Assert.That(() => DbAccess.Database.Run(s => s.GetSkalar("SELECT COUNT(1) FROM " + ImageMeta.TableName)), Is.EqualTo(400)); }
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)); }