예제 #1
0
        public void LoadContext_throws_if_context_assembly_not_specified()
        {
            var tool          = new MyMigrationTool();
            var configuration = new Configuration();

            Assert.Equal(
                Strings.ContextAssemblyNotSpecified,
                Assert.Throws <InvalidOperationException>(() => tool.LoadContext(configuration)).Message);
        }
예제 #2
0
        public void LoadContext_throws_if_context_type_not_specified_and_multiple_DbContext_found_in_assembly()
        {
            var tool          = new MyMigrationTool();
            var configuration = new Configuration();

            configuration.AddCommandLine(
                new[]
            {
                "--ContextAssembly=EntityFramework.Design.Tests.dll"
            });

            Assert.Equal(
                Strings.FormatAssemblyContainsMultipleDbContext(Assembly.GetExecutingAssembly().FullName),
                Assert.Throws <InvalidOperationException>(() => tool.LoadContext(configuration)).Message);
        }
예제 #3
0
        public void LoadContext_throws_if_context_type_is_not_DbContext()
        {
            var tool          = new MyMigrationTool();
            var configuration = new Configuration();

            configuration.AddCommandLine(
                new[]
            {
                "--ContextAssembly=EntityFramework.Design.Tests.dll",
                "--ContextType=Microsoft.Data.Entity.Design.Tests.MigrationToolTest+NotAContext"
            });

            Assert.Equal(
                Strings.FormatTypeIsNotDbContext("Microsoft.Data.Entity.Design.Tests.MigrationToolTest+NotAContext"),
                Assert.Throws <InvalidOperationException>(() => tool.LoadContext(configuration)).Message);
        }
예제 #4
0
        public void LoadContext_throws_if_context_type_not_found()
        {
            var tool          = new MyMigrationTool();
            var configuration = new Configuration();

            configuration.AddCommandLine(
                new[]
            {
                "--ContextAssembly=EntityFramework.Design.Tests.dll",
                "--ContextType=Microsoft.Data.Entity.Design.Tests.Vuvuzelas"
            });

            Assert.Equal(
                Strings.FormatAssemblyDoesNotContainType(
                    Assembly.GetExecutingAssembly().FullName,
                    "Microsoft.Data.Entity.Design.Tests.Vuvuzelas"),
                Assert.Throws <InvalidOperationException>(() => tool.LoadContext(configuration)).Message);
        }
예제 #5
0
        public void LoadContext_throws_if_context_type_not_specified_and_multiple_DbContext_found_in_assembly()
        {
            var tool = new MyMigrationTool();
            var configuration = new Configuration();

            configuration.AddCommandLine(
                new[]
                    {
                        "--ContextAssembly=EntityFramework.Design.Tests.dll"
                    });

            Assert.Equal(
                Strings.FormatAssemblyContainsMultipleDbContext(Assembly.GetExecutingAssembly().FullName),
                Assert.Throws<InvalidOperationException>(() => tool.LoadContext(configuration)).Message);
        }
예제 #6
0
        public void LoadContext_throws_if_context_type_is_not_DbContext()
        {
            var tool = new MyMigrationTool();
            var configuration = new Configuration();

            configuration.AddCommandLine(
                new[]
                    {
                        "--ContextAssembly=EntityFramework.Design.Tests.dll", 
                        "--ContextType=Microsoft.Data.Entity.Design.Tests.MigrationToolTest+NotAContext"
                    });

            Assert.Equal(
                Strings.FormatTypeIsNotDbContext("Microsoft.Data.Entity.Design.Tests.MigrationToolTest+NotAContext"),
                Assert.Throws<InvalidOperationException>(() => tool.LoadContext(configuration)).Message);
        }
예제 #7
0
        public void LoadContext_throws_if_context_type_not_found()
        {
            var tool = new MyMigrationTool();
            var configuration = new Configuration();

            configuration.AddCommandLine(
                new[]
                    {
                        "--ContextAssembly=EntityFramework.Design.Tests.dll", 
                        "--ContextType=Microsoft.Data.Entity.Design.Tests.Vuvuzelas"
                    });

            Assert.Equal(
                Strings.FormatAssemblyDoesNotContainType(
                    Assembly.GetExecutingAssembly().FullName,
                    "Microsoft.Data.Entity.Design.Tests.Vuvuzelas"),
                Assert.Throws<InvalidOperationException>(() => tool.LoadContext(configuration)).Message);
        }
예제 #8
0
        public void LoadContext_throws_if_context_assembly_not_specified()
        {
            var tool = new MyMigrationTool();
            var configuration = new Configuration();

            Assert.Equal(
                Strings.ContextAssemblyNotSpecified,
                Assert.Throws<InvalidOperationException>(() => tool.LoadContext(configuration)).Message);
        }