Esempio n. 1
0
        public void Format_NumericColumnObjectValue_CorrectDisplay(object value, string expected)
        {
            var factory   = new CellFormatterFactory();
            var formatter = factory.GetObject(ColumnType.Numeric);
            var text      = formatter.Format(value);

            Assert.That(text, Is.EqualTo(expected));
        }
Esempio n. 2
0
        public void Format_StringNullValue_NullDisplay(ColumnType columnType)
        {
            var factory   = new CellFormatterFactory();
            var formatter = factory.GetObject(columnType);
            var text      = formatter.Format("(null)");

            Assert.That(text, Is.EqualTo("(null)"));
        }
Esempio n. 3
0
        public void Format_BooleanColumnObjectValueForFalse_DisplayIsFalse(object value)
        {
            var factory   = new CellFormatterFactory();
            var formatter = factory.GetObject(ColumnType.Boolean);
            var text      = formatter.Format(value);

            Assert.That(text, Is.EqualTo("False"));
        }
Esempio n. 4
0
        public void Format_TextColumnObjectValueCultureSpecific_CorrectDisplay(object value, string expected, string culture)
        {
            System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(culture);
            var factory   = new CellFormatterFactory();
            var formatter = factory.GetObject(ColumnType.Text);
            var text      = formatter.Format(value);

            Assert.That(text, Is.EqualTo(expected));
        }
Esempio n. 5
0
        protected string GetCompareText(List <ColumnType> columnTypes, DataRow dataRow, int i)
        {
            if (string.IsNullOrEmpty(dataRow.GetColumnError(i)))
            {
                return(string.Empty);
            }

            var factory   = new CellFormatterFactory();
            var formatter = factory.GetObject(columnTypes[i]);

            return(formatter.Format(dataRow.GetColumnError(i)));
        }
Esempio n. 6
0
        protected string GetText(List <ColumnType> columnTypes, DataRow dataRow, int i)
        {
            var factory   = new CellFormatterFactory();
            var formatter = factory.GetObject(columnTypes[i]);

            var text = string.Empty;

            if (dataRow.IsNull(i))
            {
                text = formatter.Format(DBNull.Value);
            }
            else
            {
                text = formatter.Format(dataRow.ItemArray[i]);
            }
            return(text);
        }