示例#1
0
        public async Task ShouldGetAllApiSites()
        {
            var getAzureCloudOdsHostedInstanceQuery = new GetAzureCloudOdsHostedInstanceQuery(DefaultAzureActiveDirectoryClientInfo, DefaultTokenCache);
            var query   = new GetAzureCloudOdsHostedComponentsQuery(DefaultAzureActiveDirectoryClientInfo, DefaultTokenCache, getAzureCloudOdsHostedInstanceQuery);
            var context = new CloudOdsOperationContext
            {
                Instance          = DefaultTestCloudOdsInstance,
                TargetEnvironment = null,
                TargetRole        = CloudOdsRole.Api
            };

            var result = await query.Execute(context);

            result.Count().ShouldBe(2);
            result.Count(w => w.IsProductionApi()).ShouldBe(1);
        }
        public async Task <IEnumerable <OdsComponent> > Execute(CloudOdsInstance instance)
        {
            var cloudOdsOperationContext = new CloudOdsOperationContext
            {
                Instance = instance
            };

            var websites = await Execute(cloudOdsOperationContext);

            return(websites.Select(w => new OdsComponent
            {
                Name = w.Role.DisplayName,
                Environment = w.Environment.DisplayName,
                Url = w.Url,
                Version = instance.Version
            }));
        }
        public async Task ShouldExecute()
        {
            var getAzureCloudOdsHostedInstanceQuery = new GetAzureCloudOdsHostedInstanceQuery(DefaultAzureActiveDirectoryClientInfo, DefaultTokenCache);
            var websiteQuery     = new GetAzureCloudOdsHostedComponentsQuery(DefaultAzureActiveDirectoryClientInfo, DefaultTokenCache, getAzureCloudOdsHostedInstanceQuery);
            var performanceQuery = new GetAzureCloudOdsWebsitePerformanceLevelQuery(DefaultAzureActiveDirectoryClientInfo, DefaultTokenCache, websiteQuery, getAzureCloudOdsHostedInstanceQuery);

            var context = new CloudOdsOperationContext
            {
                Instance          = DefaultTestCloudOdsInstance,
                TargetEnvironment = CloudOdsEnvironment.Production,
                TargetRole        = CloudOdsRole.Api
            };

            var result = await performanceQuery.Execute(context);

            result.Equals(AzureWebsitePerformanceLevel.Free).ShouldBeTrue();
        }