Пример #1
0
        public void IsCompatibleWith_returns_true_if_other_is_same_or_null()
        {
            var annotation = new IndexAnnotation(new IndexAttribute());

            Assert.True(annotation.IsCompatibleWith(annotation));
            Assert.True(annotation.IsCompatibleWith(null));
        }
Пример #2
0
        public void IsCompatibleWith_returns_true_if_contained_index_lists_are_compatible()
        {
            var annotation1 = new IndexAnnotation(
                new[]
            {
                new IndexAttribute(),
                new IndexAttribute("EekyBear"),
                new IndexAttribute("EekyBear")
                {
                    Order = 0, IsClustered = false, IsUnique = true
                }
            });

            var annotation2 = new IndexAnnotation(
                new[]
            {
                new IndexAttribute {
                    Order = 1
                },
                new IndexAttribute("EekyBear")
                {
                    Order = 0
                },
                new IndexAttribute {
                    IsClustered = true, IsUnique = false
                },
            });

            Assert.True(annotation1.IsCompatibleWith(annotation2));
            Assert.True(annotation2.IsCompatibleWith(annotation1));
        }
Пример #3
0
        public void IsCompatibleWith_returns_false_if_other_is_not_an_IndexAnnotation()
        {
            var annotation = new IndexAnnotation(new IndexAttribute());
            var result     = annotation.IsCompatibleWith(new Random());

            Assert.False(result);
            Assert.Equal(Strings.IncompatibleTypes("Random", "IndexAnnotation"), result.ErrorMessage);
        }
Пример #4
0
        public void IsCompatibleWith_returns_false_if_any_contained_indexes_are_not_compatible()
        {
            var annotation1 = new IndexAnnotation(
                new[]
            {
                new IndexAttribute(),
                new IndexAttribute("EekyBear"),
                new IndexAttribute("EekyBear")
                {
                    Order = 0, IsClustered = false, IsUnique = true
                }
            });

            var annotation2 = new IndexAnnotation(
                new[]
            {
                new IndexAttribute {
                    Order = 1
                },
                new IndexAttribute("EekyBear")
                {
                    Order = 1
                },
                new IndexAttribute {
                    IsClustered = true, IsUnique = false
                },
            });

            var result = annotation1.IsCompatibleWith(annotation2);

            Assert.False(result);
            Assert.Equal(Strings.ConflictingIndexAttributeProperty("Order", "0", "1"), result.ErrorMessage);

            result = annotation2.IsCompatibleWith(annotation1);
            Assert.False(result);
            Assert.Equal(Strings.ConflictingIndexAttributeProperty("Order", "1", "0"), result.ErrorMessage);
        }