public void GenericSingleThrowsOnListWithMoreThanOneElement() { var list = new SimpleResultSet(Records(2)); Assert.Throws<InvalidOperationException>(() => list.Single<TestType>()); }
public void GenericSingleReturnsSingleElement() { var list = new SimpleResultSet(Records(1)); Assert.AreEqual("0", list.Single<TestType>().Data); }
public void GenericSingleThrowsOnEmptyList() { var list = new SimpleResultSet(Records(0)); Assert.Throws<InvalidOperationException>(() => list.Single<TestType>()); }
public void SingleWithCriteriaMatchingOneRecordReturnsMatch() { var list = new SimpleResultSet(Records(10)); Assert.AreEqual("8", list.Single<TestType>(t => t.Data.EndsWith("8")).Data); }
public void SingleWithFailingCriteriaThrows() { var list = new SimpleResultSet(Records(20)); Assert.Throws<InvalidOperationException>(() => list.Single<TestType>(t => t.Data.EndsWith("A"))); }
public void GenericSingleThrowsOnListWithMoreThanOneElement() { var list = new SimpleResultSet(Records(2)); Assert.Throws <InvalidOperationException>(() => list.Single <TestType>()); }
public void GenericSingleThrowsOnEmptyList() { var list = new SimpleResultSet(Records(0)); Assert.Throws <InvalidOperationException>(() => list.Single <TestType>()); }
public void GenericSingleReturnsSingleElement() { var list = new SimpleResultSet(Records(1)); Assert.AreEqual("0", list.Single <TestType>().Data); }
public void SingleWithFailingCriteriaThrows() { var list = new SimpleResultSet(Records(20)); Assert.Throws <InvalidOperationException>(() => list.Single <TestType>(t => t.Data.EndsWith("A"))); }
public void SingleWithCriteriaMatchingOneRecordReturnsMatch() { var list = new SimpleResultSet(Records(10)); Assert.AreEqual("8", list.Single <TestType>(t => t.Data.EndsWith("8")).Data); }