public void UnitTest3() { var conn = new MockDbConnection(); conn.Mocks .WhenTag("EMPLOYEES") .ReturnsTable(MockTable.Empty() .AddColumns("ID", "Name") .AddRow(1, "Scott")); var data = GetEmployees(conn); Assert.AreEqual("Scott", data[0][1]); }
public void Mock_ReturnsScalar_MockTable_TypedColumns_Test() { var conn = new MockDbConnection(); MockTable table = MockTable.Empty() .AddColumns(("Col1", typeof(int))) .AddRow(11); conn.Mocks .WhenAny() .ReturnsTable(table); DbCommand cmd = conn.CreateCommand(); object result = cmd.ExecuteScalar(); Assert.AreEqual(11, result); }