public void pluralizer_factory_test() { // Arrange string tableName = "aspnet_Applications"; string result = tableName; ePluralizerTypes classType = EnumFactory.Parse <ePluralizerTypes>("Unchanged"); PluralizerFactory factory = new PluralizerFactory(); // Act result = factory.SetWord(tableName, classType); // Assert Assert.AreEqual(tableName, result); }
public void pluralizer_factory_returns_unchanged_class_name_for_non_entity_type() { // Arrange string tableName = "Customer"; string result = tableName; ePluralizerTypes classType = EnumFactory.Parse <ePluralizerTypes>("Unchanged"); PluralizerFactory factory = new PluralizerFactory(); // Act result = factory.SetWord(tableName, classType); // Assert Assert.AreEqual(tableName, result); }
public string ToPropertyName() { if (this.Alias.ToLower() == script.Settings.DataOptions.VersionColumnName.ToLower()) { return(this.Alias); } else { ////return script.DnpUtils.SetPascalCase(this.Alias); //return this.Alias; ePluralizerTypes propertyType = EnumFactory.Parse <ePluralizerTypes>(script.Settings.Pluralizer.PropertyNames.Selected); PluralizerFactory factory = new PluralizerFactory(); string result = factory.SetWord(this.Alias, propertyType); return(result); } }
public void plural_table_name_is_replaced_with_singular_table_name_using_singular_type() { // Arrange string tableName = "aspnet_Applications"; string actual = ""; string expected = "aspnet_Application"; ePluralizerTypes classType = EnumFactory.Parse <ePluralizerTypes>("Singular"); PluralizerFactory factory = new PluralizerFactory(); // Act actual = factory.SetWord(tableName, classType); // Assert Assert.AreEqual(expected, actual); }
public void table_name_with_underscore_is_correctly_kept_using_unchanged_pluralizerfactory() { // Arrange string tableName = "aspnet_Applications"; string actual = ""; string expected = "aspnet_Applications"; ePluralizerTypes classType = EnumFactory.Parse <ePluralizerTypes>("Unchanged"); PluralizerFactory factory = new PluralizerFactory(); // Act actual = factory.SetWord(tableName, classType); // Assert Assert.AreEqual(expected, actual); }
public void pluralizer_factory_returns_plural_result_for_singular_class_name_based_on_plural_setting() { // Arrange string tableName = "Customer"; string result = tableName; ePluralizerTypes classType = EnumFactory.Parse <ePluralizerTypes>("Plural"); PluralizerFactory factory = new PluralizerFactory(); // Act result = factory.SetWord(tableName, classType); string expected = "Customers"; // Assert Assert.AreEqual(expected, result); }
public void pluralizer_factory_isentityset_returns_correct_result_for_input_with_underscore() { // Arrange string tableName = "aspnet_Applications"; string result = tableName; bool isEntitySet = true; ePluralizerTypes classType = EnumFactory.Parse <ePluralizerTypes>("Unchanged"); PluralizerFactory factory = new PluralizerFactory(); // Act result = factory.SetWord(tableName, classType, isEntitySet); // Assert Assert.AreEqual(tableName, result); }
public void table_name_with_underscore_is_correctly_kept_using_unchanged_pluralizerfactory() { // Arrange string tableName = "aspnet_Applications"; string actual = ""; string expected = "aspnet_Applications"; ePluralizerTypes classType = EnumFactory.Parse<ePluralizerTypes>("Unchanged"); PluralizerFactory factory = new PluralizerFactory(); // Act actual = factory.SetWord(tableName, classType); // Assert Assert.AreEqual(expected, actual); }
public void plural_table_name_is_replaced_with_singular_table_name_using_singular_type() { // Arrange string tableName = "aspnet_Applications"; string actual = ""; string expected = "aspnet_Application"; ePluralizerTypes classType = EnumFactory.Parse<ePluralizerTypes>("Singular"); PluralizerFactory factory = new PluralizerFactory(); // Act actual = factory.SetWord(tableName, classType); // Assert Assert.AreEqual(expected, actual); }
public void pluralizer_factory_isentityset_returns_plural_entitysetname_for_non_underscore_class_name() { // Arrange string tableName = "Project"; string result = tableName; bool isEntitySet = true; ePluralizerTypes classType = EnumFactory.Parse <ePluralizerTypes>("Unchanged"); PluralizerFactory factory = new PluralizerFactory(); // Act result = factory.SetWord(tableName, classType, isEntitySet); string expected = "Projects"; // Assert Assert.AreEqual(expected, result); }
/// <summary> /// Fixes tablenames that will be used as class names to make sure /// they are valid classnames. /// </summary> /// <param name="tableName">The table name to fix.</param> /// <param name="isEntitySet">Should this be rendered as an EntitySet. Determines the pluralization.</param> /// <returns></returns> public static string CleanUpClassName(string tableName, bool isEntitySet) { string result = tableName; ePluralizerTypes classType = EnumFactory.Parse<ePluralizerTypes>(Settings.Pluralizer.ClassNames.Selected); PluralizerFactory factory = new PluralizerFactory(); result = factory.SetWord(tableName, classType, isEntitySet); return result; }
/// <summary> /// Constructs a proper property name based on the pluralizer settings in CondorXE Common tab. /// </summary> /// <returns></returns> public virtual string ToPropertyName() { if (this.Alias.ToLower() == _script.Settings.DataOptions.VersionColumnName.ToLower()) { return this.Alias; } else { if (!string.IsNullOrEmpty(_propertyName)) { return _propertyName; } ePluralizerTypes propertyType = EnumFactory.Parse<ePluralizerTypes>(_script.Settings.Pluralizer.PropertyNames.Selected); PluralizerFactory factory = new PluralizerFactory(); _propertyName = factory.SetWord(this.Alias, propertyType); return _propertyName; } }
public string ToPropertyName() { if (this.Alias.ToLower() == script.Settings.DataOptions.VersionColumnName.ToLower()) { return this.Alias; } else { ////return script.DnpUtils.SetPascalCase(this.Alias); //return this.Alias; ePluralizerTypes propertyType = EnumFactory.Parse<ePluralizerTypes>(script.Settings.Pluralizer.PropertyNames.Selected); PluralizerFactory factory = new PluralizerFactory(); string result = factory.SetWord(this.Alias, propertyType); return result; } }