Beispiel #1
0
        public void LeaveStringUnformatted()
        {
            var formatter = new UnformattedTextFormatter();
            const string columnName = "Column_Name";

            Assert.AreEqual(columnName, formatter.FormatText(columnName));
        }
        public void UnformattedPlural()
        {
            var          formatter  = new UnformattedTextFormatter();
            const string columnName = "Column_Name";

            Assert.AreEqual("Column_Names", formatter.FormatPlural(columnName));
        }
        public void LeaveStringUnformatted()
        {
            var          formatter  = new UnformattedTextFormatter();
            const string columnName = "Column_Name";

            Assert.AreEqual(columnName, formatter.FormatText(columnName));
        }
Beispiel #4
0
        public static ITextFormatter GetTextFormatter(ApplicationPreferences applicationPreferences)
        {
            ITextFormatter formatter;

            switch (applicationPreferences.FieldNamingConvention)
            {
            case FieldNamingConvention.SameAsDatabase:
                formatter = new UnformattedTextFormatter();
                break;

            default:
                throw new Exception("Invalid or unsupported field naming convention.");
            }

            formatter.PrefixRemovalList = applicationPreferences.FieldPrefixRemovalList;

            return(formatter);
        }
Beispiel #5
0
        public void UnformattedSingular()
        {
            var formatter = new UnformattedTextFormatter();
            const string columnName = "Column_Names";

            Assert.AreEqual("Column_Name", formatter.FormatSingular(columnName));
        }
Beispiel #6
0
        public static ITextFormatter GetTextFormatter(ApplicationPreferences applicationPreferences)
        {
            ITextFormatter formatter;
            switch(applicationPreferences.FieldNamingConvention)
            {
                case FieldNamingConvention.SameAsDatabase:
                    formatter = new UnformattedTextFormatter();
                    break;
                case FieldNamingConvention.CamelCase:
                    formatter = new CamelCaseTextFormatter();
                    break;
                case FieldNamingConvention.PascalCase:
                    formatter = new PascalCaseTextFormatter();
                    break;
                case FieldNamingConvention.Prefixed:
                    formatter = new PrefixedTextFormatter(applicationPreferences.Prefix);
                    break;
                default:
                    throw new Exception("Invalid or unsupported field naming convention.");
            }

            formatter.PrefixRemovalList = applicationPreferences.FieldPrefixRemovalList;

            return formatter;
        }