Esempio n. 1
0
        public void VerifyValidationError(IDatabase database, string expectedError, string expectedLongestName)
        {
            MigrationReport report = MigrationReport.Create((Database)database, string.Empty, A.Fake <IMigrationContext>());

            Assert.AreEqual(expectedError, report.Error, "The error is wrong.");
            Assert.AreEqual(expectedLongestName, report.LongestName, "The longest name is wrong.");
        }
        private static void AssertAreEqual(IProvider sqlProvider, IProvider smoProvider, Database database)
        {
            MigrationReport report = MigrationReport.Create(database, string.Empty);

            Assert.IsEmpty(report.Error);
            var sqlTranslator = new CommandsToSqlTranslator(sqlProvider);
            var smoTranslator = new CommandsToSqlTranslator(smoProvider);
            var context       = MockRepository.GenerateStub <IRuntimeContext>();

            ScriptComparer.AssertAreEqual(smoTranslator.TranslateToSql(database, context), sqlTranslator.TranslateToSql(database, context));
        }
Esempio n. 3
0
        public void VerifyMigrationReportProps(IDatabase database,
                                               IEnumerable <DataType> expectedDataTypes,
                                               IEnumerable <DataType> expectedPrimaryKeyDataTypes,
                                               IEnumerable <DataType> expectedIdentityDataTypes,
                                               string expectedLongestName)
        {
            const string    migrationName = "Test Migration";
            MigrationReport report        = MigrationReport.Create((Database)database, migrationName, A.Fake <IMigrationContext>());

            Assert.AreEqual(migrationName, report.MigrationName);
            Assert.IsEmpty(report.Error, "These cases should not have any errors.");
            CollectionAssert.AreEquivalent(expectedDataTypes.ToList(), report.DataTypes.ToList(), "The collection of used data types is wrong.");
            CollectionAssert.AreEquivalent(expectedPrimaryKeyDataTypes.ToList(), report.PrimaryKeyDataTypes.ToList(), "The collection of used data types for primary keys is wrong.");
            CollectionAssert.AreEquivalent(expectedIdentityDataTypes.ToList(), report.IdentityDataTypes.ToList(), "The collection of used data types for identity columns is wrong.");
            Assert.AreEqual(expectedLongestName, report.LongestName, "The longest name is wrong.");
        }