Exemplo n.º 1
0
        public void AssetTransfer_ValidateSupportedLocation_OtherSiteCollectionRelativeRejectTest()
        {
            //Note: This is more of a system test rather than unit given its dependency on SharePoint

            using (var targetClientContext = TestCommon.CreateClientContext(TestCommon.AppSetting("SPOTargetSiteUrl")))
            {
                using (var sourceClientContext = TestCommon.CreateClientContext())
                {
                    // Needs valid client contexts as they are part of the checks.
                    AssetTransfer assetTransfer = new AssetTransfer(sourceClientContext, targetClientContext);
                    var           result        = assetTransfer.ValidateAssetInSupportedLocation($"/sites/fakesitecollection/images/afakeimage.jpg");
                    var           expected      = false;

                    Assert.AreEqual(expected, result);
                }
            }
        }
Exemplo n.º 2
0
        public void AssetTransfer_ValiateSupportedLocation_SameCtxRejectTest()
        {
            //Note: This is more of a system test rather than unit given its dependency on SharePoint

            using (var targetClientContext = TestCommon.CreateClientContext())
            {
                using (var sourceClientContext = TestCommon.CreateClientContext())
                {
                    // Needs valid client contexts as they are part of the checks.
                    AssetTransfer assetTransfer = new AssetTransfer(sourceClientContext, targetClientContext);
                    var           webUrl        = sourceClientContext.Web.EnsureProperty(o => o.ServerRelativeUrl);
                    var           result        = assetTransfer.ValidateAssetInSupportedLocation($"{webUrl}/siteassets/rightfile.jpg");
                    var           expected      = false;

                    Assert.AreEqual(expected, result);
                }
            }
        }
Exemplo n.º 3
0
        public void AssetTransfer_ValidateSupportedLocation_ImageOnSubsiteAcceptTest()
        {
            //Note: This is more of a system test rather than unit given its dependency on SharePoint

            using (var targetClientContext = TestCommon.CreateClientContext(TestCommon.AppSetting("SPOTargetSiteUrl")))
            {
                using (var sourceClientContext = TestCommon.CreateClientContext())
                {
                    // Needs valid client contexts as they are part of the checks.
                    AssetTransfer assetTransfer = new AssetTransfer(sourceClientContext, targetClientContext);

                    var webUrl = sourceClientContext.Web.EnsureProperty(o => o.ServerRelativeUrl);

                    var result   = assetTransfer.ValidateAssetInSupportedLocation($"{webUrl}/subsite/siteassets/afakeimage.jpg");
                    var expected = true;

                    Assert.AreEqual(expected, result);
                }
            }
        }