Ejemplo n.º 1
0
 public void Format_DBNullValue_NullDisplay(ColumnType columnType)
 {
     var factory = new CellFormatterFactory();
     var formatter = factory.GetObject(columnType);
     var text = formatter.Format(DBNull.Value);
     Assert.That(text, Is.EqualTo("(null)"));
 }
Ejemplo n.º 2
0
 public void Format_DateTimeColumnObjectValue_CorrectDisplay(object value, string expected)
 {
     var factory = new CellFormatterFactory();
     var formatter = factory.GetObject(ColumnType.DateTime);
     var text = formatter.Format(value);
     Assert.That(text, Is.EqualTo(expected));
 }
Ejemplo n.º 3
0
 public void Format_BooleanColumnObjectValueForTrue_DisplayIsTrue(object value)
 {
     var factory = new CellFormatterFactory();
     var formatter = factory.GetObject(ColumnType.Boolean);
     var text = formatter.Format(value);
     Assert.That(text, Is.EqualTo("True"));
 }
Ejemplo n.º 4
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));
        }
Ejemplo n.º 5
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;
        }
Ejemplo n.º 6
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));
 }