Skip to content

Commit

Permalink
WIP: Dns gen update
Browse files Browse the repository at this point in the history
  • Loading branch information
bquantump committed Sep 16, 2020
1 parent 932730f commit 2c0317c
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 27 deletions.
14 changes: 12 additions & 2 deletions sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/Zone.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 14 additions & 20 deletions sdk/dns/Azure.ResourceManager.Dns/tests/Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Azure.ResourceManager.Dns.Models;
using System.Collections.Generic;
using System.Net;
using NUnit.Framework;

namespace Azure.Management.Dns.Tests
{
Expand All @@ -32,25 +33,23 @@ public static bool AreEqualPrereq(
return false;
}

if (first.Tags != null && second.Tags != null)
if (first.Tags == null || second.Tags == null)
{
if (first.Tags.Count != second.Tags.Count)
{
return false;
}
return false;

foreach (string key in first.Tags.Keys)
{
if (!second.Tags.ContainsKey(key) ||
first.Tags[key] != second.Tags[key])
{
return false;
}
}
}
else{
if (first.Tags.Count != second.Tags.Count)
{
return false;
}
foreach (string key in first.Tags.Keys)
{
if (!second.Tags.ContainsKey(key) ||
first.Tags[key] != second.Tags[key])
{
return false;
}
}

return true;
}
Expand All @@ -64,12 +63,7 @@ public static bool AreEqual(
return false;
}

if (first != null && second != null)
{
return ignoreEtag || (first.Etag == second.Etag);
}

return true;
return ignoreEtag || (first.Etag == second.Etag);
}

public static bool AreEqual(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
using Azure.Management.Resources;
using Azure.ResourceManager.Dns.Models;
using Azure.ResourceManager.Dns.Tests;

using System;
using System.Collections.Generic;
namespace Azure.Management.Dns.Tests
{
[TestFixture]
Expand Down Expand Up @@ -63,6 +64,8 @@ public async Task DnsCreateZoneDeleteAndUpdate()
aZone.Tags.Add("key2", "val2");
response = await ZonesOperations.CreateOrUpdateAsync(resourceGroup, this.defaultZoneName, aZone);
Assert.IsTrue(Helper.AreEqual(response, aZone, ignoreEtag: true));
Assert.IsTrue(response.Value.ZoneType == ZoneType.Public);
Assert.IsTrue(String.Equals(response.Value.Name, this.defaultZoneName, StringComparison.OrdinalIgnoreCase));
var delResponse = await ZonesOperations.StartDeleteAsync(resourceGroup, this.defaultZoneName);
Assert.IsNotNull(delResponse);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public async Task ClearChallengeCacheforRecord()
this.resourceGroup = Recording.GenerateAssetName("Default-Dns-");
await Helper.TryRegisterResourceGroupAsync(ResourceGroupsOperations, this.location, this.resourceGroup);
var aZone = new Zone("Global");
aZone.ZoneType = ZoneType.Public;
await ZonesOperations.CreateOrUpdateAsync(this.resourceGroup, this.zoneNameForList, aZone);
setupRun = true;

Expand Down Expand Up @@ -118,7 +117,6 @@ public async Task DnsRecordSetListByResourceGroup()
{
var namespaceName = Recording.GenerateAssetName("sdk-RecordSet");
var aZone = new Zone("Global");
aZone.ZoneType = ZoneType.Public;
var zoneName = "azure.ameredmondlocal2.dns";
await ZonesOperations.CreateOrUpdateAsync(resourceGroup, zoneName, aZone);

Expand Down Expand Up @@ -158,7 +156,6 @@ public async Task DnsRecordSetListByResourceGroupTop()
{
var namespaceName = Recording.GenerateAssetName("sdk-RecordSet");
var aZone = new Zone("Global");
aZone.ZoneType = ZoneType.Public;
var zoneName = "azure.ameredmondlocaltoptest.dns";
await ZonesOperations.CreateOrUpdateAsync(resourceGroup, zoneName, aZone);

Expand Down Expand Up @@ -192,7 +189,6 @@ public async Task DnsRecordSetListByResourceGroupNoTop()
{
var namespaceName = Recording.GenerateAssetName("sdk-RecordSet");
var aZone = new Zone("Global");
aZone.ZoneType = ZoneType.Public;
var zoneName = "azure.ameredmondlocalNotoptest.dns";
await ZonesOperations.CreateOrUpdateAsync(resourceGroup, zoneName, aZone);

Expand Down

0 comments on commit 2c0317c

Please sign in to comment.