public void CollectionNamesCaseInsensitiveByDefault_RegisterCollectionThrowsArgumentExceptionForDuplicateKeyVaryingOnlyOnCasing()
        {
            var entityDataModelBuilder = new EntityDataModelBuilder(StringComparer.OrdinalIgnoreCase);

            entityDataModelBuilder.RegisterEntitySet <Category>("Categories", x => x.Name);

            var exception = Assert.Throws <ArgumentException>(() => entityDataModelBuilder.RegisterEntitySet <Category>("categories", x => x.Name));

            Assert.Equal("An item with the same key has already been added.", exception.Message);
        }
        public void CollectionNamesCaseInsensitiveByDefault_ResolveCollectionVaryingCollectionNameCasing()
        {
            var entityDataModelBuilder = new EntityDataModelBuilder(StringComparer.OrdinalIgnoreCase);

            entityDataModelBuilder.RegisterEntitySet <Category>("Categories", x => x.Name);

            var entityDataModel = entityDataModelBuilder.BuildModel();

            Assert.Same(entityDataModel.EntitySets["categories"], entityDataModel.EntitySets["Categories"]);
        }
            public WhenCalling_BuildModelWith_Models_AndCustomEntitySetName()
            {
                var entityDataModelBuilder = new EntityDataModelBuilder(StringComparer.OrdinalIgnoreCase);

                entityDataModelBuilder.RegisterEntitySet <Category>("Categories", x => x.Name, Capabilities.Insertable | Capabilities.Updatable | Capabilities.Deletable);
                entityDataModelBuilder.RegisterEntitySet <Customer>("Customers", x => x.CompanyName, Capabilities.Updatable);
                entityDataModelBuilder.RegisterEntitySet <Employee>("Employees", x => x.Id);
                entityDataModelBuilder.RegisterEntitySet <Manager>("Managers", x => x.Id);
                entityDataModelBuilder.RegisterEntitySet <Order>("Orders", x => x.OrderId, Capabilities.Insertable | Capabilities.Updatable);
                entityDataModelBuilder.RegisterEntitySet <Product>("Products", x => x.ProductId, Capabilities.Insertable | Capabilities.Updatable);

                this.entityDataModel = entityDataModelBuilder.BuildModel();
            }
            public WhenCalling_BuildModelWith_Models_AndTypeNameForEntitySetName()
            {
                var entityDataModelBuilder = new EntityDataModelBuilder(StringComparer.OrdinalIgnoreCase);

                entityDataModelBuilder.RegisterEntitySet <Category>(x => x.Name);
                entityDataModelBuilder.RegisterEntitySet <Customer>(x => x.CompanyName);
                entityDataModelBuilder.RegisterEntitySet <Employee>(x => x.Id);
                entityDataModelBuilder.RegisterEntitySet <Manager>(x => x.Id);
                entityDataModelBuilder.RegisterEntitySet <Order>(x => x.OrderId);
                entityDataModelBuilder.RegisterEntitySet <Product>(x => x.ProductId);

                this.entityDataModel = entityDataModelBuilder.BuildModel();
            }
        internal static void EnsureEDM()
        {
            var entityDataModelBuilder = new EntityDataModelBuilder(StringComparer.OrdinalIgnoreCase);

            entityDataModelBuilder.RegisterEntitySet <Category>("Categories", x => x.Name, Capabilities.Insertable | Capabilities.Updatable | Capabilities.Deletable);
            entityDataModelBuilder.RegisterEntitySet <Customer>("Customers", x => x.CompanyName, Capabilities.Updatable);
            entityDataModelBuilder.RegisterEntitySet <Employee>("Employees", x => x.Id);
            entityDataModelBuilder.RegisterEntitySet <Manager>("Managers", x => x.Id);
            entityDataModelBuilder.RegisterEntitySet <Order>("Orders", x => x.OrderId, Capabilities.Insertable | Capabilities.Updatable);
            entityDataModelBuilder.RegisterEntitySet <Product>("Products", x => x.ProductId, Capabilities.Insertable | Capabilities.Updatable);

            entityDataModelBuilder.BuildModel();
        }