public void StubResultSet_CurrentRow_Read_Success() { var result = new StubResultSet("a", "b", "c") .AddRow(1, 2, 3) .AddRow(4, 5, 6); Assert.IsTrue(result.Read(), "Read() should have returned true (row 1)"); Assert.AreEqual(1, result.CurrentRow[0], "First row was not returned after first Read()"); Assert.AreEqual(1, result.CurrentRow[0], "Subsequent call to CurrentRow did not return the same results"); Assert.IsTrue(result.Read(), "Read() should have returned true (row 2)"); Assert.AreEqual(4, result.CurrentRow[0], "Second row was not returned after second Read()"); Assert.IsFalse(result.Read(), "Read() should have encountered the end of the set"); }
public void StubResultSet_AddRow_Success() { var result = new StubResultSet("e", "f", "g"); var addRowResult = result.AddRow(3, 4, 5); Assert.AreSame(result, addRowResult, "AddRow() should have returned a reference to its owning result set"); result.Read(); Assert.AreEqual(3, result.CurrentRow[0], "The first value given to AddRow() was not preserved"); Assert.AreEqual(4, result.CurrentRow[1], "The second value given to AddRow() was not preserved"); Assert.AreEqual(5, result.CurrentRow[2], "The third value given to AddRow() was not preserved"); }
public void StubResultSet_CurrentRow_EOF_Failure() { var result = new StubResultSet(); Assert.IsFalse(result.Read(), "Read() should have encountered the end of the set"); try { var row = result.CurrentRow; Assert.Fail("Attempt to get current row should have thrown an exception (EOF)"); } catch (InvalidOperationException exception) { Assert.AreEqual("Current ResultSet is at EOF", exception.Message, "Unexpected EOF exception message"); } }