public void Index_annotations_are_serialized_to_and_from_XML()
        {
            var edmxBuilder = new StringBuilder();

            using (var context = new TeaSplitPeaHContext())
            {
                EdmxWriter.WriteEdmx(context, XmlWriter.Create(edmxBuilder));
            }

            var entityTypes = LoadStoreItemCollection(edmxBuilder.ToString()).GetItems <EntityType>().ToList();

            CheckIndex(entityTypes, "TeaPeaHBase", "Id", new IndexAnnotation(new IndexAttribute()));
            CheckIndex(entityTypes, "TeaPeaHBase", "Carbs1_Mmmm", new IndexAnnotation(new IndexAttribute("C1")));
            CheckIndex(entityTypes, "TeaPeaHBase", "Carbs1_MoreCarbs_Ahhh", new IndexAnnotation(new IndexAttribute("C2")));
            CheckIndex(entityTypes, "TeaPeaHBase", "Carbs2_Mmmm", new IndexAnnotation(new IndexAttribute("C1")));
            CheckIndex(entityTypes, "TeaPeaHBase", "Carbs2_MoreCarbs_Ahhh", new IndexAnnotation(new IndexAttribute("C2")));
            CheckIndex(
                entityTypes, "TeaPeaHBase", "Shared", new IndexAnnotation(
                    new[]
            {
                new IndexAttribute("I0", 6)
                {
                    IsClustered = true, IsUnique = true
                },
                new IndexAttribute("I1", 6)
                {
                    IsClustered = false, IsUnique = false
                },
                new IndexAttribute("I2", 7)
                {
                    IsClustered = true, IsUnique = true
                },
                new IndexAttribute("I3", 8)
                {
                    IsClustered = false, IsUnique = true
                },
                new IndexAttribute("I4", 9)
                {
                    IsClustered = true, IsUnique = false
                }
            }));
            CheckIndex(
                entityTypes, "SplitPea", "Id", new IndexAnnotation(
                    new[]
            {
                new IndexAttribute("I0", 6)
                {
                    IsClustered = true, IsUnique = true
                },
                new IndexAttribute("I3", 8)
                {
                    IsClustered = false, IsUnique = true
                },
                new IndexAttribute("I4", 9)
                {
                    IsClustered = true, IsUnique = false
                }
            }));
            CheckIndex(entityTypes, "SplitPea", "Prop1", new IndexAnnotation(new IndexAttribute("I1")
            {
                IsClustered = false
            }));
            CheckIndex(entityTypes, "SplitPea", "Carbs1_Mmmm", new IndexAnnotation(new[] { new IndexAttribute("C1") }));
            CheckIndex(entityTypes, "SplitPea", "Carbs1_MoreCarbs_Ahhh", new IndexAnnotation(new IndexAttribute("C2")));
            CheckIndex(
                entityTypes, "SplitPea1", "Id", new IndexAnnotation(
                    new[]
            {
                new IndexAttribute("I0", 6)
                {
                    IsClustered = true, IsUnique = true
                },
                new IndexAttribute("I3", 8)
                {
                    IsClustered = false, IsUnique = true
                },
                new IndexAttribute("I4", 9)
                {
                    IsClustered = true, IsUnique = false
                }
            }));
            CheckIndex(entityTypes, "SplitPea1", "Prop2", new IndexAnnotation(new IndexAttribute("I2")
            {
                IsUnique = true
            }));
            CheckIndex(entityTypes, "SplitPea1", "Carbs2_Mmmm", new IndexAnnotation(new IndexAttribute("C1")));
            CheckIndex(entityTypes, "SplitPea1", "Carbs2_MoreCarbs_Ahhh", new IndexAnnotation(new IndexAttribute("C2")));
        }
        public void Index_annotations_are_serialized_to_and_from_XML()
        {
            var edmxBuilder = new StringBuilder();

            using (var context = new TeaSplitPeaHContext())
            {
                EdmxWriter.WriteEdmx(context, XmlWriter.Create(edmxBuilder));
            }

            var entityTypes = LoadStoreItemCollection(edmxBuilder.ToString()).GetItems<EntityType>().ToList();

            CheckIndex(entityTypes, "TeaPeaHBase", "Id", new IndexAnnotation(new IndexAttribute()));
            CheckIndex(entityTypes, "TeaPeaHBase", "Carbs1_Mmmm", new IndexAnnotation(new IndexAttribute("C1")));
            CheckIndex(entityTypes, "TeaPeaHBase", "Carbs1_MoreCarbs_Ahhh", new IndexAnnotation(new IndexAttribute("C2")));
            CheckIndex(entityTypes, "TeaPeaHBase", "Carbs2_Mmmm", new IndexAnnotation(new IndexAttribute("C1")));
            CheckIndex(entityTypes, "TeaPeaHBase", "Carbs2_MoreCarbs_Ahhh", new IndexAnnotation(new IndexAttribute("C2")));
            CheckIndex(
                entityTypes, "TeaPeaHBase", "Shared", new IndexAnnotation(
                    new[]
                    {
                        new IndexAttribute("I0", 6) { IsClustered = true, IsUnique = true },
                        new IndexAttribute("I1", 6) { IsClustered = false, IsUnique = false },
                        new IndexAttribute("I2", 7) { IsClustered = true, IsUnique = true },
                        new IndexAttribute("I3", 8) { IsClustered = false, IsUnique = true },
                        new IndexAttribute("I4", 9) { IsClustered = true, IsUnique = false }
                    }));
            CheckIndex(
                entityTypes, "SplitPea", "Id", new IndexAnnotation(
                    new[]
                    {
                        new IndexAttribute("I0", 6) { IsClustered = true, IsUnique = true },
                        new IndexAttribute("I3", 8) { IsClustered = false, IsUnique = true },
                        new IndexAttribute("I4", 9) { IsClustered = true, IsUnique = false }
                    }));
            CheckIndex(entityTypes, "SplitPea", "Prop1", new IndexAnnotation(new IndexAttribute("I1") { IsClustered = false }));
            CheckIndex(entityTypes, "SplitPea", "Carbs1_Mmmm", new IndexAnnotation(new[] { new IndexAttribute("C1") }));
            CheckIndex(entityTypes, "SplitPea", "Carbs1_MoreCarbs_Ahhh", new IndexAnnotation(new IndexAttribute("C2")));
            CheckIndex(
                entityTypes, "SplitPea1", "Id", new IndexAnnotation(
                    new[]
                    {
                        new IndexAttribute("I0", 6) { IsClustered = true, IsUnique = true },
                        new IndexAttribute("I3", 8) { IsClustered = false, IsUnique = true },
                        new IndexAttribute("I4", 9) { IsClustered = true, IsUnique = false }
                    }));
            CheckIndex(entityTypes, "SplitPea1", "Prop2", new IndexAnnotation(new IndexAttribute("I2") { IsUnique = true }));
            CheckIndex(entityTypes, "SplitPea1", "Carbs2_Mmmm", new IndexAnnotation(new IndexAttribute("C1")));
            CheckIndex(entityTypes, "SplitPea1", "Carbs2_MoreCarbs_Ahhh", new IndexAnnotation(new IndexAttribute("C2")));
        }