Skip to content

Commit a449954

Browse files
committed
more unit tests
1 parent a91c6af commit a449954

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

MapDataReader.Tests/TestActualCode.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ namespace MapDataReader.Tests
1111
public enum MyEnum
1212
{
1313
FirstDude,
14-
SecondDude
14+
SecondDude,
15+
Third,
1516
}
1617

1718
[GenerateDataReaderMapper]
@@ -120,8 +121,8 @@ public void TestEnumAssign()
120121
o.SetPropertyByName("Dude", 1);
121122
Assert.IsTrue(o.Dude == MyEnum.SecondDude);
122123

123-
o.SetPropertyByName("Dude", (byte)1); //let's shove a BYTE in there!
124-
Assert.IsTrue(o.Dude == MyEnum.SecondDude); //eat this, boxing!!
124+
o.SetPropertyByName("Dude", (byte)2); //let's shove a BYTE in there!
125+
Assert.IsTrue(o.Dude == MyEnum.Third); //eat this, boxing!!
125126
}
126127

127128
[TestMethod]
@@ -145,10 +146,11 @@ public void TestDatatReader()
145146
new DataColumn("LOOOOOoong", typeof(long)),
146147
new DataColumn("BirthDay", typeof(DateTime)),
147148
new DataColumn("Elapsed", typeof(TimeSpan)),
149+
new DataColumn("ByeArray", typeof(byte[])),
148150
});
149151
var date = new DateTime(2022, 09, 09);
150-
dt.Rows.Add(123, "ggg", true, 3213, 123, date, TimeSpan.FromSeconds(123));
151-
dt.Rows.Add(3, "fgdk", false, 11123, 321, date, TimeSpan.FromSeconds(123));
152+
dt.Rows.Add(123, "ggg", true, 3213, 123, date, TimeSpan.FromSeconds(123), new byte[] { 3, 2, 1 });
153+
dt.Rows.Add(3, "fgdk", false, 11123, 321, date, TimeSpan.FromSeconds(123), new byte[] { 5, 6, 7, 8 });
152154

153155
var list = dt.CreateDataReader().ToMyObject();
154156

@@ -161,6 +163,7 @@ public void TestDatatReader()
161163
Assert.IsTrue(list[0].LOOOOOoong == 123);
162164
Assert.IsTrue(list[0].BirthDay == date);
163165
Assert.IsTrue(list[0].Elapsed == TimeSpan.FromSeconds(123));
166+
Assert.IsTrue(list[0].ByeArray.SequenceEqual(new byte[3] { 3, 2, 1 }));
164167

165168

166169
Assert.IsTrue(list[1].Id == 3);
@@ -170,6 +173,7 @@ public void TestDatatReader()
170173
Assert.IsTrue(list[1].LOOOOOoong == 321);
171174
Assert.IsTrue(list[1].BirthDay == date);
172175
Assert.IsTrue(list[1].Elapsed == TimeSpan.FromSeconds(123));
176+
Assert.IsTrue(list[1].ByeArray.SequenceEqual(new byte[4] { 5, 6, 7, 8 }));
173177
}
174178

175179
[TestMethod]
@@ -207,3 +211,4 @@ public class ChildClass : BaseClass
207211
public string Name { get; set; }
208212
}
209213
}
214+

0 commit comments

Comments
 (0)