public void FromEmptyDbReader_ExpectDefaultOfString() { _readerStub.Read().Returns(false); var sut = new SingleResultOrDefaultCommandInvoker <string>(_serviceCommand); var result = sut.Invoke(_serviceManager); Assert.AreEqual(default(string), result); }
public void FromDbReaderWithOneRecord_CompareResult_ExpectSame() { _readerStub.Read().Returns(true, false); _serviceCommand.MapResult(_readerStub).Returns(_returnedResult); var sut = new SingleResultOrDefaultCommandInvoker <string>(_serviceCommand); var result = sut.Invoke(_serviceManager); Assert.AreEqual(_returnedResult, result); }
public void FromDbReaderWithTwoRecords_ExpectException() { _readerStub.Read().Returns(true, true, false); _serviceCommand.MapResult(_readerStub).Returns(_returnedResult); var sut = new SingleResultOrDefaultCommandInvoker <string>(_serviceCommand); Assert.Throws <InvalidOperationException>(() => { sut.Invoke(_serviceManager); }); }