Пример #1
0
        public static int SetUpDefaultRemoteAppApplications(Mock<IRemoteAppManagementClient> clientMock, string collectionName)
        {
            ISetup<IRemoteAppManagementClient, Task<GetPublishedApplicationListResult>> setup = null;

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

            response.ResultList = new List<PublishedApplicationDetails>()
            {
                new PublishedApplicationDetails()
                {
                    Name = "Mohoro RemoteApp1",
                    Alias = "App1",
                    AvailableToUsers = true,
                    CommandLineArguments = "Arg1, Arg2, Arg3",
                    Status =  AppPublishingStatus.Published
                },

                new PublishedApplicationDetails()
                {
                    Name = "Mohoro RemoteApp2",
                    Alias = "App2",
                    AvailableToUsers = false,
                    Status =  AppPublishingStatus.Publishing
                }
            };

            mockApplicationList = new List<PublishedApplicationDetails>();
            foreach (PublishedApplicationDetails app in response.ResultList)
            {
                PublishedApplicationDetails mockApp = new PublishedApplicationDetails()
                {
                    Name = app.Name,
                    Alias = app.Alias,
                    AvailableToUsers = app.AvailableToUsers,
                    CommandLineArguments = app.CommandLineArguments,
                    Status = app.Status
                };
                mockApplicationList.Add(mockApp);
            }

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

            return mockApplicationList.Count;
        }
Пример #2
0
        public static bool ContainsExpectedApplication(List<PublishedApplicationDetails> expectedResult, PublishedApplicationDetails actual)
        {
            bool isIdentical = false;

            foreach (PublishedApplicationDetails expected in expectedResult)
            {
                isIdentical = expected.Name == actual.Name;
                isIdentical &= expected.Alias == actual.Alias;
                isIdentical &= expected.AvailableToUsers == actual.AvailableToUsers;
                isIdentical &= expected.Status == actual.Status;

                if (isIdentical)
                {
                    break;
                }
            }

            return isIdentical;
        }