Ejemplo n.º 1
0
        public void FindByModelQuery_Should_Not_Return_IQueryable()
        {
            repository.Setup(r => r.Query()).Returns(items.AsQueryable());
            var found = service.Object.Find(ModelQuery.Where <DummyModel>(model => true));

            Assert.False(found is IQueryable);
        }
Ejemplo n.º 2
0
        public void FindByModelQuery_Should_Perform_Query()
        {
            service.Object.Find(ModelQuery.Where <DummyModel>(model => (int)model.Id > 2));
            ModelQuery <DummyModel> empty = null;

            service.Object.Find(empty);

            repository.Verify(r => r.Query(), Times.Exactly(2));
        }
Ejemplo n.º 3
0
        public void FindByModelQuery_Should_Use_Linq_To_Filter_Queryable()
        {
            var found = service.Object.Find(ModelQuery.Where <DummyModel>(model => (int)model.Id > 2));

            Assert.Equal(2, found.Count());
            Assert.Contains(dummy3, found);
            Assert.Contains(dummy4, found);
            Assert.DoesNotContain(dummy1, found);
            Assert.DoesNotContain(dummy2, found);
        }