Ejemplo n.º 1
0
        public void CanGetStartMenuApplication()
        {
            using (var undoContext = UndoContext.Current)
            {
                undoContext.Start();

                RemoteAppManagementClient client = GetRemoteAppManagementClient();

                CollectionListResult serviceList = null;
                Assert.DoesNotThrow(() =>
                {
                    serviceList = client.Collections.List();
                });

                Assert.NotNull(serviceList);

                Assert.NotEmpty(serviceList.Collections);

                foreach (Collection collection in serviceList.Collections)
                {
                    GetStartMenuApplicationListResult appListResult = client.Publishing.StartMenuApplicationList(collection.Name);

                    foreach (StartMenuApplication startMenuApp in appListResult.ResultList)
                    {
                        GetStartMenuApplicationResult appResult = client.Publishing.StartMenuApplication(collection.Name, startMenuApp.StartMenuAppId);

                        Assert.NotNull(appResult);
                        Assert.NotNull(appResult.Result);
                        Assert.True(appResult.StatusCode == HttpStatusCode.OK);

                        return;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private ApplicationDetailsListParameter VerifyPreconditions()
        {
            ApplicationDetailsListParameter appDetails = new ApplicationDetailsListParameter()
            {
                DetailsList = new System.Collections.Generic.List <PublishedApplicationDetails>()
                {
                    new PublishedApplicationDetails()
                }
            };

            string          appName     = null;
            string          appPath     = null;
            string          iconURI     = null;
            IconPngUrisType iconPngUris = new IconPngUrisType();

            switch (ParameterSetName)
            {
            case AppPath:
            {
                appName = Path.GetFileNameWithoutExtension(FileVirtualPath);
                appPath = FileVirtualPath;

                break;
            }

            case AppId:
            {
                GetStartMenuApplicationResult startMenu = Client.Publishing.StartMenuApplication(CollectionName, StartMenuAppId);
                appName     = startMenu.Result.Name;
                appPath     = startMenu.Result.VirtualPath;
                iconURI     = startMenu.Result.IconUri;
                iconPngUris = new IconPngUrisType()
                {
                    IconPngUris = startMenu.Result.IconPngUris,
                };
                break;
            }
            }

            appDetails.DetailsList[0].Name        = String.IsNullOrWhiteSpace(DisplayName) ? appName : DisplayName;
            appDetails.DetailsList[0].VirtualPath = appPath;

            appDetails.DetailsList[0].IconUri     = iconURI;
            appDetails.DetailsList[0].IconPngUris = iconPngUris;

            appDetails.DetailsList[0].Alias = "";

            appDetails.DetailsList[0].CommandLineArguments = CommandLine;

            appDetails.DetailsList[0].AvailableToUsers = true;

            return(appDetails);
        }
Ejemplo n.º 3
0
        public static int SetUpDefaultRemoteAppStartMenuByName(Mock <IRemoteAppManagementClient> clientMock, string collectionName, string programName)
        {
            ISetup <IRemoteAppManagementClient, Task <GetStartMenuApplicationResult> > setup = null;

            GetStartMenuApplicationResult response = new GetStartMenuApplicationResult()
            {
                RequestId  = "122-13342",
                StatusCode = System.Net.HttpStatusCode.OK
            };

            response.Result = new StartMenuApplication()
            {
                Name                 = programName,
                StartMenuAppId       = "123456",
                VirtualPath          = @"C:\Application\" + programName,
                CommandLineArguments = "Arg1, Arg2, Arg3",
                IconUri              = @"C:\Application\" + programName,
            };

            mockStartMenuList = new List <StartMenuApplication>()
            {
                new StartMenuApplication()
                {
                    Name                 = response.Result.Name,
                    StartMenuAppId       = response.Result.StartMenuAppId,
                    VirtualPath          = response.Result.VirtualPath,
                    CommandLineArguments = response.Result.CommandLineArguments,
                    IconUri              = response.Result.IconUri
                }
            };

            setup = clientMock.Setup(c => c.Publishing.StartMenuApplicationAsync(collectionName, programName, It.IsAny <CancellationToken>()));
            setup.Returns(Task.Factory.StartNew(() => response));

            return(mockStartMenuList.Count);
        }