예제 #1
0
        public void CheckAllEntitiesReturned()
        {
            var simpleEntities = SimpleEntity.CreateSimpleEntities();
            var query          = new EagerLoadingQueryStrategy <SimpleEntity>(p => p.Id);

            simpleEntities.AddQueryStrategy(query).Count().ShouldEqual(simpleEntities.Count());
        }
        public void CheckConstructors()
        {
            new EagerLoadingQueryStrategy().Includes.Count().ShouldEqual(0);

            var query = new EagerLoadingQueryStrategy("1");

            query.Includes.Count().ShouldEqual(1);
            query.Includes.First().ShouldEqual("1");

            query = new EagerLoadingQueryStrategy("1", "2", "3");
            query.Includes.Count().ShouldEqual(3);
            query.Includes.First().ShouldEqual("1");
            query.Includes.Last().ShouldEqual("3");

            query = new EagerLoadingQueryStrategy(new[] { "1", "2", "3" });
            query.Includes.Count().ShouldEqual(3);
            query.Includes.First().ShouldEqual("1");
            query.Includes.Last().ShouldEqual("3");

            query = new EagerLoadingQueryStrategy(new[] { "1", "2", "3", "", null });
            query.Includes.Count().ShouldEqual(3);
            query.Includes.First().ShouldEqual("1");
            query.Includes.Last().ShouldEqual("3");

            query = new EagerLoadingQueryStrategy(new[] { "1", "2", "3" }, new[] { "1", "2", "3" });
            query.Includes.Count().ShouldEqual(6);

            query = new EagerLoadingQueryStrategy(new[] { "1", "2", "3" }, new[] { "1", "2", "3" }, "1");
            query.Includes.Count().ShouldEqual(7);

            query = new EagerLoadingQueryStrategy(new[] { "1", "2", "3" }, "1", "2", "3");
            query.Includes.Count().ShouldEqual(6);
        }
        public void CheckConstructors()
        {
            new EagerLoadingQueryStrategy().Includes.Count().ShouldEqual(0);

            var query = new EagerLoadingQueryStrategy("1");
            query.Includes.Count().ShouldEqual(1);
            query.Includes.First().ShouldEqual("1");

            query = new EagerLoadingQueryStrategy("1", "2", "3");
            query.Includes.Count().ShouldEqual(3);
            query.Includes.First().ShouldEqual("1");
            query.Includes.Last().ShouldEqual("3");

            query = new EagerLoadingQueryStrategy(new[] { "1", "2", "3" });
            query.Includes.Count().ShouldEqual(3);
            query.Includes.First().ShouldEqual("1");
            query.Includes.Last().ShouldEqual("3");

            query = new EagerLoadingQueryStrategy(new[] { "1", "2", "3", "", null });
            query.Includes.Count().ShouldEqual(3);
            query.Includes.First().ShouldEqual("1");
            query.Includes.Last().ShouldEqual("3");

            query = new EagerLoadingQueryStrategy(new[] { "1", "2", "3" }, new[] { "1", "2", "3" });
            query.Includes.Count().ShouldEqual(6);

            query = new EagerLoadingQueryStrategy(new[] { "1", "2", "3" }, new[] { "1", "2", "3" }, "1");
            query.Includes.Count().ShouldEqual(7);

            query = new EagerLoadingQueryStrategy(new[] { "1", "2", "3" }, "1", "2", "3");
            query.Includes.Count().ShouldEqual(6);
        }
        public void CheckAddUsingExpression()
        {
            var query = new EagerLoadingQueryStrategy<SimpleEntity>();
            query.Add(p => p.Id);
            query.Includes.Count().ShouldEqual(1);
            query.Includes.Last().ShouldEqual("Id");

            query.Add(p => p.Id, false);
            query.Includes.Count().ShouldEqual(1);

            query.Add(p => p.Id, true);
            query.Includes.Count().ShouldEqual(2);
        }
        public void CheckConstructors()
        {
            new EagerLoadingQueryStrategy<SimpleEntity>().Includes.Count().ShouldEqual(0);

            var query = new EagerLoadingQueryStrategy<SimpleEntity>(p => p.Id);
            query.Includes.Count().ShouldEqual(1);
            query.Includes.First().ShouldEqual("Id");

            query = new EagerLoadingQueryStrategy<SimpleEntity>(p => p.Id, p => p.GroupId);
            query.Includes.Count().ShouldEqual(2);
            query.Includes.First().ShouldEqual("Id");
            query.Includes.Last().ShouldEqual("GroupId");
        }
예제 #6
0
        public void CheckAddUsingExpression()
        {
            var query = new EagerLoadingQueryStrategy <SimpleEntity>();

            query.Add(p => p.Id);
            query.Includes.Count().ShouldEqual(1);
            query.Includes.Last().ShouldEqual("Id");

            query.Add(p => p.Id, false);
            query.Includes.Count().ShouldEqual(1);

            query.Add(p => p.Id, true);
            query.Includes.Count().ShouldEqual(2);
        }
예제 #7
0
        public void CheckConstructors()
        {
            new EagerLoadingQueryStrategy <SimpleEntity>().Includes.Count().ShouldEqual(0);

            var query = new EagerLoadingQueryStrategy <SimpleEntity>(p => p.Id);

            query.Includes.Count().ShouldEqual(1);
            query.Includes.First().ShouldEqual("Id");

            query = new EagerLoadingQueryStrategy <SimpleEntity>(p => p.Id, p => p.GroupId);
            query.Includes.Count().ShouldEqual(2);
            query.Includes.First().ShouldEqual("Id");
            query.Includes.Last().ShouldEqual("GroupId");
        }
        public void CheckAddUsingString()
        {
            var query = new EagerLoadingQueryStrategy<SimpleEntity>();
            query.Add("1");
            query.Includes.Count().ShouldEqual(1);
            query.Includes.Last().ShouldEqual("1");

            query.Add("");
            query.Includes.Count().ShouldEqual(1);

            query.Add(default(string));
            query.Includes.Count().ShouldEqual(1);

            query.Add("2", false);
            query.Includes.Count().ShouldEqual(1);

            query.Add("2");
            query.Includes.Count().ShouldEqual(2);
        }
        public void CheckAdd()
        {
            var query = new EagerLoadingQueryStrategy();
            query.Add("1");
            query.Includes.Count().ShouldEqual(1);
            query.Includes.Last().ShouldEqual("1");

            query.Add("");
            query.Includes.Count().ShouldEqual(1);

            query.Add(null);
            query.Includes.Count().ShouldEqual(1);

            query.Add("2", false);
            query.Includes.Count().ShouldEqual(1);

            query.Add("2");
            query.Includes.Count().ShouldEqual(2);
        }
예제 #10
0
        public void CheckAddUsingString()
        {
            var query = new EagerLoadingQueryStrategy <SimpleEntity>();

            query.Add("1");
            query.Includes.Count().ShouldEqual(1);
            query.Includes.Last().ShouldEqual("1");

            query.Add("");
            query.Includes.Count().ShouldEqual(1);

            query.Add(default(string));
            query.Includes.Count().ShouldEqual(1);

            query.Add("2", false);
            query.Includes.Count().ShouldEqual(1);

            query.Add("2");
            query.Includes.Count().ShouldEqual(2);
        }
        public void CheckAdd()
        {
            var query = new EagerLoadingQueryStrategy();

            query.Add("1");
            query.Includes.Count().ShouldEqual(1);
            query.Includes.Last().ShouldEqual("1");

            query.Add("");
            query.Includes.Count().ShouldEqual(1);

            query.Add(null);
            query.Includes.Count().ShouldEqual(1);

            query.Add("2", false);
            query.Includes.Count().ShouldEqual(1);

            query.Add("2");
            query.Includes.Count().ShouldEqual(2);
        }
 public void CheckAllEntitiesReturned()
 {
     var simpleEntities = SimpleEntity.CreateSimpleEntities();
     var query = new EagerLoadingQueryStrategy<SimpleEntity>(p => p.Id);
     simpleEntities.AddQueryStrategy(query).Count().ShouldEqual(simpleEntities.Count());
 }