public static void ClassInitialize(TestContext testContext) { TestModel.ClassInitialize(testContext); }
public void TestSchemaUpdater() { Assert.AreEqual(18, SchemaUpdater.CurrentSchemaRevision); var testModel = new TestModel() { TestContext = TestContext }; TestModel.ClassInitialize(TestContext); testModel.TestInitialize(); testModelFile(testModel, "testModel.idpDB"); string filename = null; // test all revisions without a data filter applied // we don't need to test upgrade from 5 to 6; it simply forces reapplication of the basic filters // we don't need to test upgrade from 4 to 5; it's a simple null value fix filename = "testModel-v4.idpDB"; File.Copy("testModel.idpDB", filename, true); downgradeToRevision(filename, 4); testModelFile(testModel, filename); filename = "testModel-v3.idpDB"; File.Copy("testModel.idpDB", filename, true); downgradeToRevision(filename, 3); testModelFile(testModel, filename); filename = "testModel-v2.idpDB"; File.Copy("testModel.idpDB", filename, true); downgradeToRevision(filename, 2); testModelFile(testModel, filename); filename = "testModel-v1.idpDB"; File.Copy("testModel.idpDB", filename, true); downgradeToRevision(filename, 1); testModelFile(testModel, filename); filename = "testModel-v0.idpDB"; File.Copy("testModel.idpDB", filename, true); downgradeToRevision(filename, 0); testModelFile(testModel, filename); // test all revisions with a data filter applied (only check that the update worked this time) File.Copy("testModel.idpDB", "testFilter.idpDB", true); var dataFilter = new DataFilter { MaximumQValue = 1 }; using (var sessionFactory = SessionFactoryFactory.CreateSessionFactory("testFilter.idpDB")) using (var session = testModel.session = sessionFactory.OpenSession()) { dataFilter.ApplyBasicFilters(session); } filename = "testFilter-v4.idpDB"; File.Copy("testFilter.idpDB", filename, true); downgradeToRevision(filename, 4); testFilterFile(filename); filename = "testFilter-v3.idpDB"; File.Copy("testFilter.idpDB", filename, true); downgradeToRevision(filename, 3); testFilterFile(filename); filename = "testFilter-v2.idpDB"; File.Copy("testFilter.idpDB", filename, true); downgradeToRevision(filename, 2); testFilterFile(filename); filename = "testFilter-v1.idpDB"; File.Copy("testFilter.idpDB", filename, true); downgradeToRevision(filename, 1); testFilterFile(filename); filename = "testFilter-v0.idpDB"; File.Copy("testFilter.idpDB", filename, true); downgradeToRevision(filename, 0); testFilterFile(filename); }
public static void ClassInitialize(TestContext testContext) { TestModel.ClassInitialize(testContext); File.Copy("testModel.idpDB", "testQueryReader.idpDB"); }
public void TestSchemaUpdater() { Assert.AreEqual(15, SchemaUpdater.CurrentSchemaRevision); var testModel = new TestModel() { TestContext = TestContext }; TestModel.ClassInitialize(TestContext); testModel.TestInitialize(); testModelFile(testModel, "testModel.idpDB"); string filename = null; // test all revisions without a data filter applied // we don't need to test upgrade from 12 to 13; the extra table (PeptideModificationProbability) is ignored and necessary for the current NHibernate bindings // we don't need to test upgrade from 11 to 12; the changed table (XICMetrics) is ignored // we don't need to test upgrade from 10 to 11; the extra columns (GeneGroups, Genes) are ignored // we don't need to test upgrade from 9 to 10; the extra tables (XICMetrics, XICMetricsSettings) are ignored // we don't need to test upgrade from 8 to 9; the extra columns (GeneLevelFiltering, DistinctMatchFormat) are ignored // we don't need to test upgrade from 7 to 8; the extra columns are ignored // we don't need to test upgrade from 5 to 6; it simply forces reapplication of the basic filters // we don't need to test upgrade from 4 to 5; it's a simple null value fix filename = "testModel-v4.idpDB"; File.Copy("testModel.idpDB", filename, true); downgradeToRevision(filename, 4); testModelFile(testModel, filename); filename = "testModel-v3.idpDB"; File.Copy("testModel.idpDB", filename, true); downgradeToRevision(filename, 3); testModelFile(testModel, filename); filename = "testModel-v2.idpDB"; File.Copy("testModel.idpDB", filename, true); downgradeToRevision(filename, 2); testModelFile(testModel, filename); filename = "testModel-v1.idpDB"; File.Copy("testModel.idpDB", filename, true); downgradeToRevision(filename, 1); testModelFile(testModel, filename); filename = "testModel-v0.idpDB"; File.Copy("testModel.idpDB", filename, true); downgradeToRevision(filename, 0); testModelFile(testModel, filename); // test all revisions with a data filter applied (only check that the update worked this time) File.Copy("testModel.idpDB", "testFilter.idpDB", true); var dataFilter = new DataFilter { MaximumQValue = 1 }; using (var sessionFactory = SessionFactoryFactory.CreateSessionFactory("testFilter.idpDB")) using (var session = testModel.session = sessionFactory.OpenSession()) { dataFilter.ApplyBasicFilters(session); } filename = "testFilter-v4.idpDB"; File.Copy("testFilter.idpDB", filename, true); downgradeToRevision(filename, 4); testFilterFile(filename); filename = "testFilter-v3.idpDB"; File.Copy("testFilter.idpDB", filename, true); downgradeToRevision(filename, 3); testFilterFile(filename); filename = "testFilter-v2.idpDB"; File.Copy("testFilter.idpDB", filename, true); downgradeToRevision(filename, 2); testFilterFile(filename); filename = "testFilter-v1.idpDB"; File.Copy("testFilter.idpDB", filename, true); downgradeToRevision(filename, 1); testFilterFile(filename); filename = "testFilter-v0.idpDB"; File.Copy("testFilter.idpDB", filename, true); downgradeToRevision(filename, 0); testFilterFile(filename); }