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

            Assert.Throws <InvalidOperationException>(() => list.Single <TestType>());
        }
コード例 #7
0
        public void GenericSingleThrowsOnEmptyList()
        {
            var list = new SimpleResultSet(Records(0));

            Assert.Throws <InvalidOperationException>(() => list.Single <TestType>());
        }
コード例 #8
0
        public void GenericSingleReturnsSingleElement()
        {
            var list = new SimpleResultSet(Records(1));

            Assert.AreEqual("0", list.Single <TestType>().Data);
        }
コード例 #9
0
        public void SingleWithFailingCriteriaThrows()
        {
            var list = new SimpleResultSet(Records(20));

            Assert.Throws <InvalidOperationException>(() => list.Single <TestType>(t => t.Data.EndsWith("A")));
        }
コード例 #10
0
        public void SingleWithCriteriaMatchingOneRecordReturnsMatch()
        {
            var list = new SimpleResultSet(Records(10));

            Assert.AreEqual("8", list.Single <TestType>(t => t.Data.EndsWith("8")).Data);
        }