public void TestParse_NoFormatString_ParsesGenerically()
 {
     DateTimeColumn column = new DateTimeColumn("created");
     DateTime actual = (DateTime)column.Parse("1/19/2013");
     DateTime expected = new DateTime(2013, 1, 19);
     Assert.AreEqual(expected, actual, "The value was not parsed as expected.");
 }
 public void TestParse_FormatString_ParsesExactly()
 {
     DateTimeColumn column = new DateTimeColumn("created");
     column.InputFormat = "d";
     DateTime actual = (DateTime)column.Parse("1/19/2013");
     DateTime expected = new DateTime(2013, 1, 19);
     Assert.Equal(expected, actual);
 }
 public void TestParse_FormatProvider_NoFormatString_ParsesGenerically()
 {
     DateTimeColumn column = new DateTimeColumn("created");
     column.FormatProvider = CultureInfo.CurrentCulture;
     DateTime actual = (DateTime)column.Parse("1/19/2013");
     DateTime expected = new DateTime(2013, 1, 19);
     Assert.Equal(expected, actual);
 }
 public void TestParse_FormatProvider_FormatString_ParsesExactly()
 {
     DateTimeColumn column = new DateTimeColumn("created");
     column.InputFormat = "d";
     column.FormatProvider = CultureInfo.CurrentCulture;
     DateTime actual = (DateTime)column.Parse("1/19/2013");
     DateTime expected = new DateTime(2013, 1, 19);
     Assert.AreEqual(expected, actual, "The value was not parsed as expected.");
 }
Exemplo n.º 5
0
 public void TestColumnDefinitions_GetEnumerable_Explicit()
 {
     Schema schema = new Schema();
     ColumnDefinition id = new Int32Column("id");
     ColumnDefinition name = new StringColumn("name");
     ColumnDefinition created = new DateTimeColumn("created");
     schema.AddColumn(id).AddColumn(name).AddColumn(created);
     IEnumerable collection = schema.ColumnDefinitions;
     IEnumerator enumerator = collection.GetEnumerator();
 }
Exemplo n.º 6
0
 public void TestColumnDefinitions_FindByIndex()
 {
     Schema schema = new Schema();
     ColumnDefinition id = new Int32Column("id");
     ColumnDefinition name = new StringColumn("name");
     ColumnDefinition created = new DateTimeColumn("created");
     schema.AddColumn(id).AddColumn(name).AddColumn(created);
     ColumnCollection collection = schema.ColumnDefinitions;
     Assert.AreSame(id, collection[0], "The first column definition was wrong.");
     Assert.AreSame(name, collection[1], "The second column definition was wrong.");
     Assert.AreSame(created, collection[2], "The third column definition was wrong.");
 }
 public void TestColumnDefinitions_GetEnumerable_Explicit()
 {
     FixedLengthSchema schema = new FixedLengthSchema();
     ColumnDefinition id = new Int32Column("id");
     ColumnDefinition name = new StringColumn("name");
     ColumnDefinition created = new DateTimeColumn("created");
     schema.AddColumn(id, new Window(10))
         .AddColumn(name, new Window(25))
         .AddColumn(created, new Window(10));
     IEnumerable collection = schema.ColumnDefinitions;
     IEnumerator enumerator = collection.GetEnumerator();
 }
 public DateTimePropertyMapping(DateTimeColumn column, PropertyInfo property)
 {
     this.column = column;
     this.property = property;
 }
 public void TestParse_ValueBlank_NullReturned()
 {
     DateTimeColumn column = new DateTimeColumn("created");
     DateTime? actual = (DateTime?)column.Parse("    ");
     DateTime? expected = null;
     Assert.AreEqual(expected, actual, "The value was not parsed as expected.");
 }
Exemplo n.º 10
0
 public void TestCtor_SetsName_LowerCase_Trimmed()
 {
     DateTimeColumn column = new DateTimeColumn(" Name   ");
     Assert.AreEqual("name", column.ColumnName, "The name was not set as expected.");
 }
Exemplo n.º 11
0
 public InitializedTestTable()
     : base("MyTable")
 {
     DateColumn = new DateColumn(this, "MyDateColumn");
     DateTimeColumn = new DateTimeColumn(this, "MyDateTimeColumn");
     DecimalColumn = new DecimalColumn(this, "MyDecimalColumn");
     DoubleColumn = new DoubleColumn(this, "MyDoubleColumn");
     IntColumn = new IntColumn(this, "MyIntColumn");
     StringColumn = new StringColumn(this, "MyStringColumn");
 }
Exemplo n.º 12
0
 public ColumnAdder<DateTimeResult> Column(DateTimeColumn column)
 {
     return new ColumnAdder<DateTimeResult>(this, column);
 }
Exemplo n.º 13
0
 public void TestCtor_SetsName_Trimmed()
 {
     DateTimeColumn column = new DateTimeColumn(" Name   ");
     Assert.Equal("Name", column.ColumnName);
 }
Exemplo n.º 14
0
 public void TestParse_ValueBlank_NullReturned()
 {
     DateTimeColumn column = new DateTimeColumn("created");
     DateTime? actual = (DateTime?)column.Parse("    ");
     DateTime? expected = null;
     Assert.Equal(expected, actual);
 }