Beispiel #1
0
        private static async Task TestLoadImplementation(Core.Services.PnPContext context)
        {
            // TestCommon.Instance.Mocking = false;
            await context.Web.LoadAsync(w => w.Title, w => w.Description, w => w.Lists);

            Assert.IsNotNull(context.Web);
            Assert.IsNotNull(context.Web.Lists);
            Assert.IsTrue(context.Web.IsPropertyAvailable(w => w.Title));
            Assert.IsTrue(context.Web.IsPropertyAvailable(w => w.Description));
            Assert.IsTrue(context.Web.Lists.Length > 0);
        }
Beispiel #2
0
        private static async Task TestGetImplementation(Core.Services.PnPContext context)
        {
            var web = await context.Web.GetAsync(w => w.Title, w => w.Description, w => w.Lists);

            // The objects connected to the context should be empty
            Assert.IsFalse(context.Web.IsPropertyAvailable(w => w.Title));
            Assert.IsFalse(context.Web.IsPropertyAvailable(w => w.Description));
            Assert.IsTrue(context.Web.Lists.Length == 0);

            // The results of the Get method should be valid
            Assert.IsNotNull(web);
            Assert.IsTrue(web.IsPropertyAvailable(w => w.Title));
            Assert.IsTrue(web.IsPropertyAvailable(w => w.Description));
            Assert.IsNotNull(web.Lists);
            Assert.IsTrue(web.Lists.Length > 0);

            // The resulting objects should be different from the objects in the context hierarchy
            Assert.AreNotEqual(context.Web.GetHashCode(), web.GetHashCode());
            Assert.AreNotEqual(context.Web.Lists.GetHashCode(), web.Lists.GetHashCode());
        }