Пример #1
0
        public void SampleUseRepositoryGetList()
        {
            var db     = GetMockDB();
            var rep    = new Repository.Model.Repository(db);
            var result = rep.GetList(new iValueRangeSpecification(2, 3), 0, 10);

            Assert.Equal(2, result.Count);
            Assert.False(result.Any(n => 2 > n.iValue && n.iValue > 3));
        }
Пример #2
0
        public void SampleUseRepositoryGetList_ORSpecification()
        {
            var db     = GetMockDB();
            var rep    = new Repository.Model.Repository(db);
            var spec   = new iValueRangeSpecification(2, 3).Or(new sValueContainsSpecification("1"));
            var result = rep.GetList(spec, 0, 10);

            Assert.Equal(3, result.Count);
            Assert.True(result.Any(n => 2 <= n.iValue && n.iValue <= 3));
            Assert.True(result.Any(n => n.sValue.Contains("1")));
        }