Пример #1
0
        public void UniquifyName_should_return_unique_name_when_conflict()
        {
            var codeGenerator = new CSharpMigrationCodeGenerator();

            var @namespace = "Migrations";

            var generatedMigration1
                = codeGenerator.Generate(
                      "201108162311111_Migration",
                      new MigrationOperation[] { },
                      "Source",
                      "Target",
                      @namespace,
                      "Migration");

            var generatedMigration2
                = codeGenerator.Generate(
                      "201108162311111_Migration1",
                      new MigrationOperation[] { },
                      "Source",
                      "Target",
                      @namespace,
                      "Migration1");

            var migrationAssembly
                = new MigrationAssembly(
                      new MigrationCompiler("cs")
                      .Compile(
                          @namespace,
                          generatedMigration1,
                          generatedMigration2),
                      @namespace);

            Assert.Equal("Migration2", migrationAssembly.UniquifyName("Migration"));
        }
        public void UniquifyName_should_return_unique_name_when_conflict()
        {
            var codeGenerator = new CSharpMigrationCodeGenerator();

            var @namespace = "Migrations";

            var generatedMigration1
                = codeGenerator.Generate(
                    "201108162311111_Migration",
                    new MigrationOperation[] { },
                    "Source",
                    "Target",
                    @namespace,
                    "Migration");

            var generatedMigration2
                = codeGenerator.Generate(
                    "201108162311111_Migration1",
                    new MigrationOperation[] { },
                    "Source",
                    "Target",
                    @namespace,
                    "Migration1");

            var migrationAssembly
                = new MigrationAssembly(
                    new MigrationCompiler("cs")
                        .Compile(
                            @namespace,
                            generatedMigration1,
                            generatedMigration2),
                    @namespace);

            Assert.Equal("Migration2", migrationAssembly.UniquifyName("Migration"));
        }
Пример #3
0
        public void UniquifyName_should_return_name_when_already_unique()
        {
            var migrationAssembly = new MigrationAssembly(new MockAssembly(), "MockNamespace");

            Assert.Equal("Foo", migrationAssembly.UniquifyName("Foo"));
        }
        public void UniquifyName_should_return_name_when_already_unique()
        {
            var migrationAssembly = new MigrationAssembly(new MockAssembly(), "MockNamespace");

            Assert.Equal("Foo", migrationAssembly.UniquifyName("Foo"));
        }