diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/Zone.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/Zone.cs
index 9ac7f2274f453..6c67fccd0cf63 100644
--- a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/Zone.cs
+++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/Zone.cs
@@ -42,7 +42,7 @@ public Zone(string location) : base(location)
/// The type of this DNS zone (Public or Private).
/// A list of references to virtual networks that register hostnames in this DNS zone. This is a only when ZoneType is Private.
/// A list of references to virtual networks that resolve records in this DNS zone. This is a only when ZoneType is Private.
- internal Zone(string id, string name, string type, string location, IDictionary tags, string etag, long? maxNumberOfRecordSets, long? numberOfRecordSets, IReadOnlyList nameServers, ZoneType? zoneType, IList registrationVirtualNetworks, IList resolutionVirtualNetworks) : base(id, name, type, location, tags)
+ protected Zone(string id, string name, string type, string location, IDictionary tags, string etag, long? maxNumberOfRecordSets, long? numberOfRecordSets, IReadOnlyList nameServers, ZoneType? zoneType, IList registrationVirtualNetworks, IList resolutionVirtualNetworks) : base(id, name, type, location, tags)
{
Etag = etag;
MaxNumberOfRecordSets = maxNumberOfRecordSets;
@@ -53,6 +53,16 @@ internal Zone(string id, string name, string type, string location, IDictionary<
ResolutionVirtualNetworks = resolutionVirtualNetworks;
}
+ internal Zone(string id, string name, string type, string location, IDictionary tags, string etag, long? maxNumberOfRecordSets, long? numberOfRecordSets, IReadOnlyList nameServers, IList registrationVirtualNetworks, IList resolutionVirtualNetworks) : base(id, name, type, location, tags)
+ {
+ Etag = etag;
+ MaxNumberOfRecordSets = maxNumberOfRecordSets;
+ NumberOfRecordSets = numberOfRecordSets;
+ NameServers = nameServers;
+ RegistrationVirtualNetworks = registrationVirtualNetworks;
+ ResolutionVirtualNetworks = resolutionVirtualNetworks;
+ }
+
/// The etag of the zone.
public string Etag { get; set; }
/// The maximum number of record sets that can be created in this DNS zone. This is a read-only property and any attempt to set this value will be ignored.
@@ -62,7 +72,7 @@ internal Zone(string id, string name, string type, string location, IDictionary<
/// The name servers for this DNS zone. This is a read-only property and any attempt to set this value will be ignored.
public IReadOnlyList NameServers { get; }
/// The type of this DNS zone (Public or Private).
- public ZoneType? ZoneType { get; set; }
+ public ZoneType? ZoneType { get; }
/// A list of references to virtual networks that register hostnames in this DNS zone. This is a only when ZoneType is Private.
public IList RegistrationVirtualNetworks { get; }
/// A list of references to virtual networks that resolve records in this DNS zone. This is a only when ZoneType is Private.
diff --git a/sdk/dns/Azure.ResourceManager.Dns/tests/Helper.cs b/sdk/dns/Azure.ResourceManager.Dns/tests/Helper.cs
index 1cf30c9d6c4b6..bb402c1c8710c 100644
--- a/sdk/dns/Azure.ResourceManager.Dns/tests/Helper.cs
+++ b/sdk/dns/Azure.ResourceManager.Dns/tests/Helper.cs
@@ -7,6 +7,7 @@
using Azure.ResourceManager.Dns.Models;
using System.Collections.Generic;
using System.Net;
+using NUnit.Framework;
namespace Azure.Management.Dns.Tests
{
@@ -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;
}
@@ -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(
diff --git a/sdk/dns/Azure.ResourceManager.Dns/tests/Tests/ScenarioTests.DnsTests.DnsZone.cs b/sdk/dns/Azure.ResourceManager.Dns/tests/Tests/ScenarioTests.DnsTests.DnsZone.cs
index 2ebb6adaaf86d..4662f7ded9cb1 100644
--- a/sdk/dns/Azure.ResourceManager.Dns/tests/Tests/ScenarioTests.DnsTests.DnsZone.cs
+++ b/sdk/dns/Azure.ResourceManager.Dns/tests/Tests/ScenarioTests.DnsTests.DnsZone.cs
@@ -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]
@@ -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);
}
diff --git a/sdk/dns/Azure.ResourceManager.Dns/tests/Tests/ScenarioTests.DnsTests.RecordSet.cs b/sdk/dns/Azure.ResourceManager.Dns/tests/Tests/ScenarioTests.DnsTests.RecordSet.cs
index 7944ad4b7ba93..9fb0e0eb51f1c 100644
--- a/sdk/dns/Azure.ResourceManager.Dns/tests/Tests/ScenarioTests.DnsTests.RecordSet.cs
+++ b/sdk/dns/Azure.ResourceManager.Dns/tests/Tests/ScenarioTests.DnsTests.RecordSet.cs
@@ -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;
@@ -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);
@@ -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);
@@ -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);