Esempio n. 1
0
 public void WordsWithFandV_GetTableName_Correct()
 {
     Assert.Equal("Knives", PluralConventionUtility.Pluralize("Knife"));
     Assert.Equal("Strives", PluralConventionUtility.Pluralize("Strife"));
     Assert.Equal("Calves", PluralConventionUtility.Pluralize("Calf"));
     Assert.Equal("Elves", PluralConventionUtility.Pluralize("Elf"));
     Assert.Equal("Lives", PluralConventionUtility.Pluralize("Life"));
 }
Esempio n. 2
0
 public void WordsEndingWithShChZ_GetTableName_Correct()
 {
     Assert.Equal("Bitches", PluralConventionUtility.Pluralize("Bitch"));
     Assert.Equal("Smashes", PluralConventionUtility.Pluralize("Smash"));
     Assert.Equal("Sexes", PluralConventionUtility.Pluralize("Sex"));
     Assert.Equal("Boxes", PluralConventionUtility.Pluralize("Box"));
     Assert.Equal("Sanchezes", PluralConventionUtility.Pluralize("Sanchez"));
 }
Esempio n. 3
0
        private ApiItemModel <TItem> CreateNewItemModel <TItem>()
            where TItem : class, new()
        {
            var itemModel = new ApiItemModel <TItem>(Model.DataSource);

            Model.Items.Add(itemModel);
            Model.Roots.Add(itemModel);

            itemModel.RootName = PluralConventionUtility.Pluralize(typeof(TItem).Name);

            return(itemModel);
        }
Esempio n. 4
0
 public void BasicStrings_GetTableName_Correct()
 {
     Assert.Equal("Dogs", PluralConventionUtility.Pluralize("Dog"));
     Assert.Equal("Morons", PluralConventionUtility.Pluralize("Moron"));
     Assert.Equal("Problems", PluralConventionUtility.Pluralize("Problem"));
 }
Esempio n. 5
0
 public void Type_GetTableName_Correct()
 {
     Assert.Equal("MyTestEntities", PluralConventionUtility.GetTableName <MyTestEntity>());
 }
Esempio n. 6
0
 public void ComplexPlurals_GetTableName_Correct()
 {
     Assert.Equal("People", PluralConventionUtility.Pluralize("Person"));
     Assert.Equal("Teeth", PluralConventionUtility.Pluralize("Tooth"));
 }
Esempio n. 7
0
 public void WordsEndingWithS_GetTableName_Correct()
 {
     Assert.Equal("bosses", PluralConventionUtility.Pluralize("boss"));
     Assert.Equal("glasses", PluralConventionUtility.Pluralize("glass"));
     Assert.Equal("dresses", PluralConventionUtility.Pluralize("dress"));
 }
Esempio n. 8
0
 public void WordsEndingWithY_GetTableName_Correct()
 {
     Assert.Equal("Puppies", PluralConventionUtility.Pluralize("Puppy"));
     Assert.Equal("Doggies", PluralConventionUtility.Pluralize("Doggy"));
     Assert.Equal("Pussies", PluralConventionUtility.Pluralize("Pussy"));
 }
 public T GetByPrimaryKey <T>(ObjectContext database, int id)
     where T : class
 {
     return((T)database.GetObjectByKey(new EntityKey(database.DefaultContainerName + "." + PluralConventionUtility.GetTableName <T>(), GetPrimaryKeyInfo <T>().Name, id)));
 }