Beispiel #1
0
        //[TestMethod]
        public void SPRepository_Test_Get_ByLookupValue()
        {
            using (ClientContext context = new ClientContext(ConfigurationManager.AppSettings["SiteUrl"]))
            {
                SecureString password = Common.ToSecureString(ConfigurationManager.AppSettings["UserPassword"]);
                context.Credentials = new SharePointOnlineCredentials(ConfigurationManager.AppSettings["UserLogin"], password);
                SPClientRepository <MockTestSPEntity> repo = new SPClientRepository <MockTestSPEntity>(context);

                List <MockTestSPEntity> result = repo.Query(test => test.LookupTarget.Title == "Lookup 2").ToList();

                Assert.AreEqual(1, result.Count);
            }
        }
Beispiel #2
0
        //[TestMethod]
        public void SPRepository_Test_GetAllData()
        {
            using (ClientContext context = new ClientContext(ConfigurationManager.AppSettings["SiteUrl"]))
            {
                SecureString password = Common.ToSecureString(ConfigurationManager.AppSettings["UserPassword"]);
                context.Credentials = new SharePointOnlineCredentials(ConfigurationManager.AppSettings["UserLogin"], password);
                IEntityRepository <MockTestSPEntity> repo = new SPClientRepository <MockTestSPEntity>(context);

                DateTime date = DateTime.Now;

                List <MockTestSPEntity> result = repo.Query(test => test.ModifiedDate > date).ToList();

                Assert.AreEqual(10, result.Count);
            }
        }