Exemplo n.º 1
0
        public void GetItemsByQueryAndInclude()
        {
            CSOMSharePointRepository <CommunityEventModel> events = new CSOMSharePointRepository <CommunityEventModel>(testUrl);
            string        listName = "CommunityEvents";
            CSOMCamlQuery query    = new CSOMCamlQuery();
            string        include  = "";
            IEnumerable <CommunityEventModel> e = events.GetItemsByQuery(listName, query, include);

            Assert.IsNotNull(e);
        }
Exemplo n.º 2
0
        public void GetItemsByQueryWithRowLimit()
        {
            IEnumerable <CommunityEventModel> events;
            CSOMSharePointRepository <CommunityEventModel> repository = new CSOMSharePointRepository <CommunityEventModel>(testUrl);
            string        listName = "CommunityEvents";
            int           rowLimit = 1;
            CSOMCamlQuery query    = new CSOMCamlQuery();

            query.Caml     = "<Where><Eq><FieldRef Name='ShowOnCalendar' /><Value Type='Choice'>Yes</Value></Eq></Where>";
            query.RowLimit = rowLimit;

            events = repository.GetItemsByQuery(listName, query);
            Assert.IsNotNull(events);
            Assert.AreEqual(rowLimit, events.Count());
        }
Exemplo n.º 3
0
        public void GetItemsByQuery()
        {
            IEnumerable <CommunityEventModel> events;
            CSOMSharePointRepository <CommunityEventModel> repository = new CSOMSharePointRepository <CommunityEventModel>(testUrl);
            string        listName = "CommunityEvents";
            CSOMCamlQuery query    = new CSOMCamlQuery();

            query.Caml = "<Where><Eq><FieldRef Name='ShowOnCalendar' /><Value Type='Choice'>Yes</Value></Eq></Where>";

            events = repository.GetItemsByQuery(listName, query);
            Assert.IsNotNull(events);

            if (events.Count() <= 0)
            {
                Assert.Fail("No items were returned");
            }
        }
Exemplo n.º 4
0
        public void GetItemsByQueryWithOrder()
        {
            IEnumerable <CommunityEventModel> events;
            CSOMSharePointRepository <CommunityEventModel> repository = new CSOMSharePointRepository <CommunityEventModel>(testUrl);
            string        listName = "CommunityEvents";
            CSOMCamlQuery query    = new CSOMCamlQuery();

            query.Caml          = "<Where><Eq><FieldRef Name='ShowOnCalendar' /><Value Type='Choice'>Yes</Value></Eq></Where>";
            query.OrderByFields = "<FieldRef Name='Title' />";

            events = repository.GetItemsByQuery(listName, query);
            Assert.IsNotNull(events);

            if (events.Count() <= 0)
            {
                Assert.Fail("No items were returned");
            }
            else
            {
                CommunityEventModel e = events.First();
                Assert.AreEqual("A", e.Title.Substring(0, 1).ToUpper());
            }
        }