|
19 | 19 | using System.IO;
|
20 | 20 | using System.Linq;
|
21 | 21 | using System.Net;
|
22 |
| -using System.Runtime.Serialization.Formatters; |
23 | 22 | using System.Text.RegularExpressions;
|
24 | 23 | using System.Threading;
|
25 | 24 | using System.Threading.Tasks;
|
@@ -1153,108 +1152,6 @@ public void GetsAllResourceGroupsWithDetails()
|
1153 | 1152 | Assert.Equal(resourceGroup4.Name, actual[3].ResourceGroupName);
|
1154 | 1153 | }
|
1155 | 1154 |
|
1156 |
| - [Fact] |
1157 |
| - [Trait(Category.AcceptanceType, Category.CheckIn)] |
1158 |
| - public void GetsResourceGroupsFilteredByTags() |
1159 |
| - { |
1160 |
| - Dictionary<string, string> tag1 = new Dictionary<string, string> { { "tag1", "val1" }, { "tag2", "val2" } }; |
1161 |
| - Dictionary<string, string> tag2 = new Dictionary<string, string> { { "tag1", "valx" } }; |
1162 |
| - Dictionary<string, string> tag3 = new Dictionary<string, string> { { "tag2", "" } }; |
1163 |
| - |
1164 |
| - ResourceGroup resourceGroup1 = new ResourceGroup(location: resourceGroupLocation, name: resourceGroupName + 1, tags: tag1); |
1165 |
| - ResourceGroup resourceGroup2 = new ResourceGroup(location: resourceGroupLocation, name: resourceGroupName + 2, tags: tag2); |
1166 |
| - ResourceGroup resourceGroup3 = new ResourceGroup(location: resourceGroupLocation, name: resourceGroupName + 3, tags: tag3); |
1167 |
| - ResourceGroup resourceGroup4 = new ResourceGroup(location: resourceGroupLocation, name: resourceGroupName + 4); |
1168 |
| - var listResult = new List<ResourceGroup>() { resourceGroup1, resourceGroup2, resourceGroup3, resourceGroup4 }; |
1169 |
| - var pagableResult = new Page<ResourceGroup>(); |
1170 |
| - pagableResult.SetItemValue(listResult); |
1171 |
| - resourceGroupMock.Setup(f => f.ListWithHttpMessagesAsync(null, null, new CancellationToken())) |
1172 |
| - .Returns(Task.Factory.StartNew(() => |
1173 |
| - new AzureOperationResponse<IPage<ResourceGroup>>() |
1174 |
| - { |
1175 |
| - Body = pagableResult |
1176 |
| - })); |
1177 |
| - SetupListForResourceGroupAsync(resourceGroup1.Name, new List<GenericResource>() { CreateGenericResource(null, null, "resource") }); |
1178 |
| - SetupListForResourceGroupAsync(resourceGroup2.Name, new List<GenericResource>() { CreateGenericResource(null, null, "resource") }); |
1179 |
| - SetupListForResourceGroupAsync(resourceGroup3.Name, new List<GenericResource>() { CreateGenericResource(null, null, "resource") }); |
1180 |
| - SetupListForResourceGroupAsync(resourceGroup4.Name, new List<GenericResource>() { CreateGenericResource(null, null, "resource") }); |
1181 |
| - |
1182 |
| - List<PSResourceGroup> groups1 = resourcesClient.FilterResourceGroups(null, |
1183 |
| - new Hashtable(new Dictionary<string, string> { { "tag1", "val1" } }), false); |
1184 |
| - |
1185 |
| - Assert.Single(groups1); |
1186 |
| - Assert.Equal(resourceGroup1.Name, groups1[0].ResourceGroupName); |
1187 |
| - |
1188 |
| - List<PSResourceGroup> groups2 = resourcesClient.FilterResourceGroups(null, |
1189 |
| - new Hashtable(new Dictionary<string, string> { { "tag2", "" } }), false); |
1190 |
| - |
1191 |
| - Assert.Equal(2, groups2.Count); |
1192 |
| - Assert.Equal(resourceGroup1.Name, groups2[0].ResourceGroupName); |
1193 |
| - Assert.Equal(resourceGroup3.Name, groups2[1].ResourceGroupName); |
1194 |
| - |
1195 |
| - List<PSResourceGroup> groups3 = resourcesClient.FilterResourceGroups(null, |
1196 |
| - new Hashtable(new Dictionary<string, string> { { "Name", "tag3" } }), false); |
1197 |
| - |
1198 |
| - Assert.Empty(groups3); |
1199 |
| - |
1200 |
| - List<PSResourceGroup> groups4 = resourcesClient.FilterResourceGroups(null, |
1201 |
| - new Hashtable(new Dictionary<string, string> { { "TAG1", "val1" } }), false); |
1202 |
| - |
1203 |
| - Assert.Single(groups4); |
1204 |
| - Assert.Equal(resourceGroup1.Name, groups4[0].ResourceGroupName); |
1205 |
| - } |
1206 |
| - |
1207 |
| - [Fact] |
1208 |
| - [Trait(Category.AcceptanceType, Category.CheckIn)] |
1209 |
| - public void GetsResourceGroupsFilteredByTagsWithDetails() |
1210 |
| - { |
1211 |
| - Dictionary<string, string> tag1 = new Dictionary<string, string> { { "tag1", "val1" }, { "tag2", "val2" } }; |
1212 |
| - Dictionary<string, string> tag2 = new Dictionary<string, string> { { "tag1", "valx" } }; |
1213 |
| - Dictionary<string, string> tag3 = new Dictionary<string, string> { { "tag2", "" } }; |
1214 |
| - |
1215 |
| - ResourceGroup resourceGroup1 = new ResourceGroup(location: resourceGroupLocation, name: resourceGroupName + 1, tags: tag1); |
1216 |
| - ResourceGroup resourceGroup2 = new ResourceGroup(location: resourceGroupLocation, name: resourceGroupName + 2, tags: tag2); |
1217 |
| - ResourceGroup resourceGroup3 = new ResourceGroup(location: resourceGroupLocation, name: resourceGroupName + 3, tags: tag3); |
1218 |
| - ResourceGroup resourceGroup4 = new ResourceGroup(location: resourceGroupLocation, name: resourceGroupName + 4); |
1219 |
| - var listResult = new List<ResourceGroup>() { resourceGroup1, resourceGroup2, resourceGroup3, resourceGroup4 }; |
1220 |
| - var pagableResult = new Page<ResourceGroup>(); |
1221 |
| - pagableResult.SetItemValue(listResult); |
1222 |
| - resourceGroupMock.Setup(f => f.ListWithHttpMessagesAsync(null, null, new CancellationToken())) |
1223 |
| - .Returns(Task.Factory.StartNew(() => |
1224 |
| - new AzureOperationResponse<IPage<ResourceGroup>>() |
1225 |
| - { |
1226 |
| - Body = pagableResult |
1227 |
| - })); |
1228 |
| - SetupListForResourceGroupAsync(resourceGroup1.Name, new List<GenericResource>() { CreateGenericResource(null, null, "resource") }); |
1229 |
| - SetupListForResourceGroupAsync(resourceGroup2.Name, new List<GenericResource>() { CreateGenericResource(null, null, "resource") }); |
1230 |
| - SetupListForResourceGroupAsync(resourceGroup3.Name, new List<GenericResource>() { CreateGenericResource(null, null, "resource") }); |
1231 |
| - SetupListForResourceGroupAsync(resourceGroup4.Name, new List<GenericResource>() { CreateGenericResource(null, null, "resource") }); |
1232 |
| - |
1233 |
| - List<PSResourceGroup> groups1 = resourcesClient.FilterResourceGroups(null, |
1234 |
| - new Hashtable(new Dictionary<string, string> { { "tag1", "val1" } }), true); |
1235 |
| - |
1236 |
| - Assert.Single(groups1); |
1237 |
| - Assert.Equal(resourceGroup1.Name, groups1[0].ResourceGroupName); |
1238 |
| - |
1239 |
| - List<PSResourceGroup> groups2 = resourcesClient.FilterResourceGroups(null, |
1240 |
| - new Hashtable(new Dictionary<string, string> { { "tag2", "" } }), true); |
1241 |
| - |
1242 |
| - Assert.Equal(2, groups2.Count); |
1243 |
| - Assert.Equal(resourceGroup1.Name, groups2[0].ResourceGroupName); |
1244 |
| - Assert.Equal(resourceGroup3.Name, groups2[1].ResourceGroupName); |
1245 |
| - |
1246 |
| - List<PSResourceGroup> groups3 = resourcesClient.FilterResourceGroups(null, |
1247 |
| - new Hashtable(new Dictionary<string, string> { { "tag3", "" } }), true); |
1248 |
| - |
1249 |
| - Assert.Empty(groups3); |
1250 |
| - |
1251 |
| - List<PSResourceGroup> groups4 = resourcesClient.FilterResourceGroups(null, |
1252 |
| - new Hashtable(new Dictionary<string, string> { { "TAG1", "val1" }}), true); |
1253 |
| - |
1254 |
| - Assert.Single(groups4); |
1255 |
| - Assert.Equal(resourceGroup1.Name, groups4[0].ResourceGroupName); |
1256 |
| - } |
1257 |
| - |
1258 | 1155 | [Fact]
|
1259 | 1156 | [Trait(Category.AcceptanceType, Category.CheckIn)]
|
1260 | 1157 | public void DeletesResourcesGroup()
|
|
0 commit comments