示例#1
0
        public void List_Basic()
        {
            string responseString = (@"
            {
	            ""value"": [{
		            ""id"": ""/subscriptions/a559b6fd-3a84-40bb-a450-b0db5ed37dfe/resourceGroups/HydraTest07152014/providers/Microsoft.Cache/Redis/hydraradiscache3"",
		            ""location"": ""NorthCentralUS"",
		            ""name"": ""hydraradiscache3"",
		            ""type"": ""Microsoft.Cache/Redis"",
		            ""tags"": {},
		            ""properties"": {
			            ""provisioningState"": ""succeeded"",
			            ""sku"": {
                            ""name"": ""Basic"",
                            ""family"": ""C"",
                            ""capacity"": 1
                        },
		                ""redisVersion"" : ""2.8"",
		                ""accessKeys"": null,
			            ""hostName"": ""hydraradiscache3.cache.icbbvt.windows-int.net"",
			            ""port"": 6379,
			            ""sslPort"": 6380
		            }
	            },
	            {
		            ""id"": ""/subscriptions/a559b6fd-3a84-40bb-a450-b0db5ed37dfe/resourceGroups/HydraTest07152014/providers/Microsoft.Cache/Redis/hydraradiscache"",
		            ""location"": ""NorthEurope"",
		            ""name"": ""hydraradiscache"",
		            ""type"": ""Microsoft.Cache/Redis"",
		            ""tags"": {""update"": ""done""},
		            ""properties"": {
			            ""provisioningState"": ""succeeded"",
			            ""sku"": {
                            ""name"": ""Basic"",
                            ""family"": ""C"",
                            ""capacity"": 1
                        },
		                ""redisVersion"" : ""2.8"",
		                ""maxMemoryPolicy"": ""AllKeysLRU"",
			            ""accessKeys"": null,
			            ""hostName"": ""hydraradiscache.cache.icbbvt.windows-int.net"",
			            ""port"": 6379,
			            ""sslPort"": 6380
		            }
	            }]
            }");

            string requestIdHeader = "0d33aff8-8a4e-4565-b893-a10e52260de0";
            
            RedisListResponse[] list = new RedisListResponse[4];
            RedisManagementClient client = Utility.GetRedisManagementClient(responseString, requestIdHeader, HttpStatusCode.OK);
            list[0] = client.Redis.List(resourceGroupName: "resource-group");
            client = Utility.GetRedisManagementClient(responseString, requestIdHeader, HttpStatusCode.OK);
            list[1] = client.Redis.ListNext(nextLink: nextLinkForAllInResourceGroup);
            client = Utility.GetRedisManagementClient(responseString, requestIdHeader, HttpStatusCode.OK);
            list[2] = client.Redis.List(null);
            client = Utility.GetRedisManagementClient(responseString, requestIdHeader, HttpStatusCode.OK);
            list[3] = client.Redis.ListNext(nextLink: nextLinkForAllInSubscription);

            foreach (RedisListResponse responseList in list)
            {
                Assert.Equal(requestIdHeader, responseList.RequestId);
                Assert.Equal(2, responseList.Value.Count);

                foreach (RedisResource response in responseList.Value)
                {
                    Assert.Contains("/subscriptions/a559b6fd-3a84-40bb-a450-b0db5ed37dfe/resourceGroups/HydraTest07152014/providers/Microsoft.Cache/Redis/hydraradiscache", response.Id);
                    Assert.Contains("North", response.Location);
                    Assert.Contains("hydraradiscache", response.Name);
                    Assert.Equal("Microsoft.Cache/Redis", response.Type);
                    Assert.Equal("succeeded", response.Properties.ProvisioningState);
                    Assert.Equal(SkuName.Basic, response.Properties.Sku.Name);
                    Assert.Equal(SkuFamily.C, response.Properties.Sku.Family);
                    Assert.Equal(1, response.Properties.Sku.Capacity);
                    Assert.Equal("2.8", response.Properties.RedisVersion);
                    Assert.Contains(".cache.icbbvt.windows-int.net", response.Properties.HostName);
                    Assert.Equal(6379, response.Properties.Port);
                    Assert.Equal(6380, response.Properties.SslPort);
                }
            }
        }
示例#2
0
        public void List_EmptyJSONFromCSM()
        {
            string responseString = (@"{}");
            RedisListResponse[] list = new RedisListResponse[4];
            
            RedisManagementClient client = Utility.GetRedisManagementClient(responseString, null, HttpStatusCode.OK);
            list[0] = client.Redis.List(resourceGroupName: "resource-group");
            client = Utility.GetRedisManagementClient(responseString, null, HttpStatusCode.OK);
            list[1] = client.Redis.ListNext(nextLink: nextLinkForAllInResourceGroup);
            client = Utility.GetRedisManagementClient(responseString, null, HttpStatusCode.OK);
            list[2] = client.Redis.List(null);
            client = Utility.GetRedisManagementClient(responseString, null, HttpStatusCode.OK);
            list[3] = client.Redis.ListNext(nextLink: nextLinkForAllInSubscription);

            foreach (RedisListResponse responseList in list)
            {
                Assert.Equal(0, responseList.Value.Count);
                Assert.Null(responseList.NextLink);
            }
        }