Esempio n. 1
0
        public async Task AddCheckRemoveAppTestAsync()
        {
            using (var clientContext = TestCommon.CreateClientContext())
            {
                AppManager manager  = new AppManager(clientContext);
                var        appBytes = OfficeDevPnP.Core.Tests.Properties.Resources.alm;

                //Test adding app
                var addedApp = await manager.AddAsync(appBytes, $"app-{appGuid}.sppkg", true);

                Assert.IsNotNull(addedApp);


                //Test availability of apps
                var availableApps = await manager.GetAvailableAsync();

                Assert.IsNotNull(availableApps);
                CollectionAssert.Contains(availableApps.Select(app => app.Id).ToList(), addedApp.Id);

                var retrievedApp = await manager.GetAvailableAsync(addedApp.Id);

                Assert.AreEqual(addedApp.Id, retrievedApp.Id);

                //Test removal
                var removeResults = await manager.RemoveAsync(addedApp.Id);

                Assert.IsTrue(removeResults);
            }
        }
Esempio n. 2
0
        public async Task DeployRetractAppAsyncTest()
        {
            using (var clientContext = TestCommon.CreateClientContext())
            {
                AppManager manager  = new AppManager(clientContext);
                var        appBytes = OfficeDevPnP.Core.Tests.Properties.Resources.almskip;

                var results = await manager.AddAsync(appBytes, $"appalmskip-{appGuid}.sppkg", true);

                var deployResults = await manager.DeployAsync(results.Id);

                Assert.IsTrue(deployResults);

                var metadata = await manager.GetAvailableAsync(results.Id);

                Assert.IsTrue(metadata.Deployed);

                var retractResults = await manager.RetractAsync(results.Id);

                Assert.IsTrue(retractResults);

                metadata = await manager.GetAvailableAsync(results.Id);

                Assert.IsFalse(metadata.Deployed);

                manager.Remove(results.Id);
            }
        }
Esempio n. 3
0
        public async Task InstallUninstallTestAsync()
        {
            using (var clientContext = TestCommon.CreateClientContext())
            {
                AppManager manager = new AppManager(clientContext);

                var appBytes = OfficeDevPnP.Core.Tests.Properties.Resources.alm;

                var appMetadata = await manager.AddAsync(appBytes, $"app-{appGuid}.sppkg", true);

                Assert.IsNotNull(appMetadata);

                var installResults = await manager.InstallAsync(appMetadata);

                Assert.IsTrue(installResults);

                //TODO: Better test required

                /*
                 * var installedMetadata = await manager.GetAvailableAsync(appMetadata.Id);
                 *
                 * Thread.Sleep(10000); // sleep 10 seconds
                 *
                 * Assert.IsTrue(installedMetadata.InstalledVersion != null);
                 */

                var uninstallResults = await manager.UninstallAsync(appMetadata);

                Assert.IsTrue(uninstallResults);

                await manager.RemoveAsync(appMetadata);
            }
        }
Esempio n. 4
0
        public async Task AddRemoveAppTestAsync()
        {
            using (var clientContext = TestCommon.CreateClientContext())
            {
                AppManager manager  = new AppManager(clientContext);
                var        appBytes = OfficeDevPnP.Core.Tests.Properties.Resources.alm;

                var results = await manager.AddAsync(appBytes, $"app-{appGuid}.sppkg");

                Assert.IsNotNull(results);

                var removeResults = await manager.RemoveAsync(results.Id);

                Assert.IsTrue(removeResults);
            }
        }