コード例 #1
0
        [Fact] // CodePlex 583
        public void RemoveDuplicateTphColumns_throws_if_column_types_do_not_match()
        {
            var mockTableType = CreateMockType("Ankh-Morpork");

            var columns = new[]
            {
                CreateColumn(
                    mockTableType, "Duke", new Properties.Primitive.PrimitivePropertyConfiguration
                {
                    ColumnType = "int"
                }),
                CreateColumn(
                    mockTableType, "Duke", new Properties.Primitive.PrimitivePropertyConfiguration
                {
                    ColumnType = "nvarchar(max)"
                })
            };
            var mappings = CreateMappings(columns, "Sam", "Vimes");

            var fixer = new TphColumnFixer(mappings);

            Assert.Equal(
                Strings.BadTphMappingToSharedColumn(
                    "Sam", "SamType", "Vimes", "VimesType", "Duke", "Ankh-Morpork",
                    Environment.NewLine + "\t" + Strings.ConflictingConfigurationValue("ColumnType", "int", "ColumnType", "nvarchar(max)")),
                Assert.Throws <MappingException>(() => fixer.RemoveDuplicateTphColumns()).Message);
        }
コード例 #2
0
        [Fact] // CodePlex 583
        public void RemoveDuplicateTphColumns_throws_if_column_facets_do_not_match()
        {
            var mockTableType = CreateMockType("Ankh-Morpork");

            var columns = new[]
            {
                CreateColumn(
                    mockTableType, "Duke", new Properties.Primitive.StringPropertyConfiguration
                {
                    IsUnicode = true
                }),
                CreateColumn(
                    mockTableType, "Duke", new Properties.Primitive.StringPropertyConfiguration
                {
                    IsUnicode = false
                })
            };
            var mappings = CreateMappings(columns, "Sam", "Vimes");

            var mockModel = new Mock <EdmModel>(DataSpace.SSpace, XmlConstants.SchemaVersionLatest);

            var fixer = new TphColumnFixer(mappings, mockTableType.Object, mockModel.Object);

            Assert.Equal(
                Strings.BadTphMappingToSharedColumn(
                    "Sam", "SamType", "Vimes", "VimesType", "Duke", "Ankh-Morpork",
                    Environment.NewLine + "\t" + Strings.ConflictingConfigurationValue("IsUnicode", "True", "IsUnicode", "False")),
                Assert.Throws <MappingException>(() => fixer.RemoveDuplicateTphColumns()).Message);
        }
コード例 #3
0
        [Fact] // CodePlex 583
        public void RemoveDuplicateTphColumns_throws_if_column_types_do_not_match()
        {
            var mockTableType = CreateMockType("Ankh-Morpork");

            var columns = new[]
                {
                    CreateColumn(
                        mockTableType, "Duke", new PrimitivePropertyConfiguration
                            {
                                ColumnType = "int"
                            }),
                    CreateColumn(
                        mockTableType, "Duke", new PrimitivePropertyConfiguration
                            {
                                ColumnType = "nvarchar(max)"
                            })
                };
            var mappings = CreateMappings(columns, "Sam", "Vimes");

            var fixer = new TphColumnFixer(mappings);

            Assert.Equal(
                Strings.BadTphMappingToSharedColumn(
                    "Sam", "SamType", "Vimes", "VimesType", "Duke", "Ankh-Morpork",
                    Environment.NewLine + "\t" + Strings.ConflictingConfigurationValue("ColumnType", "int", "ColumnType", "nvarchar(max)")),
                Assert.Throws<MappingException>(() => fixer.RemoveDuplicateTphColumns()).Message);
        }
コード例 #4
0
        [Fact] // CodePlex 583
        public void RemoveDuplicateTphColumns_throws_if_column_facets_do_not_match()
        {
            var mockTableType = CreateMockType("Ankh-Morpork");

            var columns = new[]
                {
                    CreateColumn(
                        mockTableType, "Duke", new Properties.Primitive.StringPropertyConfiguration
                            {
                                IsUnicode = true
                            }),
                    CreateColumn(
                        mockTableType, "Duke", new Properties.Primitive.StringPropertyConfiguration
                            {
                                IsUnicode = false
                            })
                };
            var mappings = CreateMappings(columns, "Sam", "Vimes");

            var fixer = new TphColumnFixer(mappings);

            Assert.Equal(
                Strings.BadTphMappingToSharedColumn(
                    "Sam", "SamType", "Vimes", "VimesType", "Duke", "Ankh-Morpork",
                    Environment.NewLine + "\t" + Strings.ConflictingConfigurationValue("IsUnicode", "True", "IsUnicode", "False")),
                Assert.Throws<MappingException>(() => fixer.RemoveDuplicateTphColumns()).Message);
        }