public static void SetUpDefaultRemoteAppRegionList(Mock <IRemoteAppManagementClient> clientMock)
        {
            ISetup <IRemoteAppManagementClient, Task <RegionListResult> > setup = null;
            RegionListResult response = new RegionListResult()
            {
                RequestId  = "23113-442",
                StatusCode = HttpStatusCode.OK,
                Regions    = new List <Region>()
                {
                    new Region()
                    {
                        Name = "West US"
                    },
                    new Region()
                    {
                        Name = "East-US"
                    },
                    new Region()
                    {
                        Name = "North Europe"
                    }
                }
            };

            mockRegionList = new List <Region>(response.Regions);

            setup = clientMock.Setup(c => c.Collections.RegionListAsync(It.IsAny <CancellationToken>()));
            setup.Returns(Task.Factory.StartNew(() => response));
        }
示例#2
0
        public void CanGetCollectionRegionList()
        {
            using (var undoContext = UndoContext.Current)
            {
                undoContext.Start();

                var client = GetRemoteAppManagementClient();

                RegionListResult result = client.Collections.RegionList();

                Assert.NotNull(result);
                Assert.Equal(HttpStatusCode.OK, result.StatusCode);
                Assert.NotEmpty(result.Regions);
            }
        }
        public override void ExecuteCmdlet()
        {
            RegionListResult response = null;

            response = CallClient(() => Client.Collections.RegionList(), Client.Collections);

            if (response != null && response.Regions.Count > 0)
            {
                WriteObject(response.Regions, true);
            }
            else
            {
                WriteVerboseWithTimestamp("No locations found.");
            }
        }