public void Generate_should_throw_when_column_rename()
        {
            var migrationProvider = new SqlCeMigrationSqlGenerator();

            var renameColumnOperation = new RenameColumnOperation("T", "c", "c'");

            Assert.Equal(Strings.SqlCeColumnRenameNotSupported, Assert.Throws<MigrationsException>(() => migrationProvider.Generate(new[] { renameColumnOperation }, "4.0").ToList()).Message);
        }
Ejemplo n.º 2
0
        public void Generate_should_throw_when_column_rename()
        {
            var migrationProvider = new SqlCeMigrationSqlGenerator();

            var renameColumnOperation = new RenameColumnOperation("T", "c", "c'");

            Assert.Equal(
                Strings.SqlCeColumnRenameNotSupported,
                Assert.Throws <MigrationsException>(() => migrationProvider.Generate(new[] { renameColumnOperation }, "4.0").ToList()).
                Message);
        }
Ejemplo n.º 3
0
        public void Generate_throws_when_operation_unknown()
        {
            var migrationSqlGenerator = new SqlCeMigrationSqlGenerator();
            var unknownOperation      = new Mock <MigrationOperation>(null).Object;

            var ex = Assert.Throws <InvalidOperationException>(
                () => migrationSqlGenerator.Generate(new[] { unknownOperation }, "4.0"));

            Assert.Equal(
                Strings.SqlServerMigrationSqlGenerator_UnknownOperation(typeof(SqlCeMigrationSqlGenerator).Name, unknownOperation.GetType().FullName),
                ex.Message);
        }
        public void Generate_throws_when_operation_unknown()
        {
            var migrationSqlGenerator = new SqlCeMigrationSqlGenerator();
            var unknownOperation = new Mock<MigrationOperation>(null).Object;

            var ex = Assert.Throws<InvalidOperationException>(
                () => migrationSqlGenerator.Generate(new[] { unknownOperation }, "4.0"));

            Assert.Equal(
                Strings.SqlServerMigrationSqlGenerator_UnknownOperation(typeof(SqlCeMigrationSqlGenerator).Name, unknownOperation.GetType().FullName),
                ex.Message);
        }
Ejemplo n.º 5
0
        public void Generate_can_output_add_column_statement_for_GUID_and_uses_newid()
        {
            var migrationSqlGenerator = new SqlCeMigrationSqlGenerator();

            var column = new ColumnModel(PrimitiveTypeKind.Guid)
            {
                Name       = "Bar",
                IsIdentity = true
            };
            var addColumnOperation = new AddColumnOperation("Foo", column);

            var sql = migrationSqlGenerator.Generate(new[] { addColumnOperation }, "2012").Join(s => s.Sql, Environment.NewLine);

            Assert.Contains("ALTER TABLE [Foo] ADD [Bar] [uniqueidentifier] DEFAULT newid()", sql);
        }
        public void Generate_can_output_add_column_statement_for_GUID_and_uses_newid()
        {
            var migrationSqlGenerator = new SqlCeMigrationSqlGenerator();

            var column = new ColumnModel(PrimitiveTypeKind.Guid)
            {
                Name = "Bar",
                IsIdentity = true
            };
            var addColumnOperation = new AddColumnOperation("Foo", column);

            var sql = migrationSqlGenerator.Generate(new[] { addColumnOperation }, "2012").Join(s => s.Sql, Environment.NewLine);

            Assert.Contains("ALTER TABLE [Foo] ADD [Bar] [uniqueidentifier] DEFAULT newid()", sql);
        }