Ejemplo n.º 1
0
        public void TestGetCapabilities()
        {
            Dictionary <string, string> tags = new Dictionary <string, string>();
            string suiteName = this.GetType().FullName;

            using (SqlManagementTestContext context = new SqlManagementTestContext(this))
            {
                SqlManagementClient sqlClient = context.GetClient <SqlManagementClient>();

                LocationCapabilities capabilities = sqlClient.Capabilities.ListByLocation(TestEnvironmentUtilities.DefaultLocation);

                Assert.NotNull(capabilities);

                foreach (ServerVersionCapability s in capabilities.SupportedServerVersions)
                {
                    Assert.NotNull(s.Name);
                    foreach (EditionCapability e in s.SupportedEditions)
                    {
                        Assert.NotNull(e.Name);
                        foreach (ServiceObjectiveCapability o in e.SupportedServiceLevelObjectives)
                        {
                            Assert.NotNull(o.Name);
                            Assert.NotNull(o.PerformanceLevel);
                            foreach (MaxSizeRangeCapability m in o.SupportedMaxSizes)
                            {
                                Assert.NotNull(m.MinValue);
                                Assert.NotNull(m.MaxValue);
                            }
                        }
                    }
                }
            }
        }
        public async Task TestGetCapabilitiesAsync()
        {
            Dictionary <string, string> tags = new Dictionary <string, string>();
            string suiteName = this.GetType().Name;

            SqlManagementClient sqlClient = GetSqlManagementClient();

            LocationCapabilities capabilities = await sqlClient.Capabilities.ListByLocationAsync(DefaultLocation);

            Assert.NotNull(capabilities);

            foreach (ServerVersionCapability s in capabilities.SupportedServerVersions)
            {
                Assert.NotNull(s.Name);
                foreach (EditionCapability e in s.SupportedEditions)
                {
                    Assert.NotNull(e.Name);
                    foreach (ServiceObjectiveCapability o in e.SupportedServiceLevelObjectives)
                    {
                        Assert.NotNull(o.Name);
                        Assert.NotNull(o.PerformanceLevel);
                        foreach (MaxSizeRangeCapability m in o.SupportedMaxSizes)
                        {
                            Assert.NotNull(m.MinValue);
                            Assert.NotNull(m.MaxValue);
                        }
                    }
                }
            }
        }
        public async Task <Response <LocationCapabilities> > ListByLocationAsync(string subscriptionId, string locationName, CapabilityGroup?include = null, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId));
            Argument.AssertNotNullOrEmpty(locationName, nameof(locationName));

            using var message = CreateListByLocationRequest(subscriptionId, locationName, include);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

            switch (message.Response.Status)
            {
            case 200:
            {
                LocationCapabilities value = default;
                using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);

                value = LocationCapabilities.DeserializeLocationCapabilities(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }