Enhanced easy to catch test coverage
This commit is contained in:
@@ -70,7 +70,7 @@ namespace AMWD.Net.Api.Cloudflare.Dns
|
|||||||
|
|
||||||
// Deletes (DELETE)
|
// Deletes (DELETE)
|
||||||
var deletes = new List<Identifier>();
|
var deletes = new List<Identifier>();
|
||||||
foreach (string delete in request.Deletes ?? [])
|
foreach (string delete in request.Deletes)
|
||||||
{
|
{
|
||||||
delete.ValidateCloudflareId();
|
delete.ValidateCloudflareId();
|
||||||
deletes.Add(new Identifier { Id = delete });
|
deletes.Add(new Identifier { Id = delete });
|
||||||
@@ -78,7 +78,7 @@ namespace AMWD.Net.Api.Cloudflare.Dns
|
|||||||
|
|
||||||
// Updates (PATCH)
|
// Updates (PATCH)
|
||||||
var patches = new List<InternalBatchUpdateRequest>();
|
var patches = new List<InternalBatchUpdateRequest>();
|
||||||
foreach (var patch in request.Updates ?? [])
|
foreach (var patch in request.Updates)
|
||||||
{
|
{
|
||||||
patch.Id.ValidateCloudflareId();
|
patch.Id.ValidateCloudflareId();
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@ namespace AMWD.Net.Api.Cloudflare.Dns
|
|||||||
|
|
||||||
// Creates (POST)
|
// Creates (POST)
|
||||||
var posts = new List<InternalDnsRecordRequest>();
|
var posts = new List<InternalDnsRecordRequest>();
|
||||||
foreach (var post in request.Creates ?? [])
|
foreach (var post in request.Creates)
|
||||||
{
|
{
|
||||||
var req = (InternalDnsRecordRequest)ValidateRequest(post);
|
var req = (InternalDnsRecordRequest)ValidateRequest(post);
|
||||||
posts.Add(req);
|
posts.Add(req);
|
||||||
@@ -98,7 +98,7 @@ namespace AMWD.Net.Api.Cloudflare.Dns
|
|||||||
|
|
||||||
// Overwrites (PUT)
|
// Overwrites (PUT)
|
||||||
var puts = new List<InternalBatchUpdateRequest>();
|
var puts = new List<InternalBatchUpdateRequest>();
|
||||||
foreach (var put in request.Overwrites ?? [])
|
foreach (var put in request.Overwrites)
|
||||||
{
|
{
|
||||||
put.Id.ValidateCloudflareId();
|
put.Id.ValidateCloudflareId();
|
||||||
|
|
||||||
|
|||||||
@@ -22,22 +22,22 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The DNS records to delete.
|
/// The DNS records to delete.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IReadOnlyCollection<string>? Deletes { get; set; }
|
public IReadOnlyCollection<string> Deletes { get; set; } = [];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The DNS records to update.
|
/// The DNS records to update.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IReadOnlyCollection<Patch>? Updates { get; set; }
|
public IReadOnlyCollection<Patch> Updates { get; set; } = [];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The DNS records to create.
|
/// The DNS records to create.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IReadOnlyCollection<Post>? Creates { get; set; }
|
public IReadOnlyCollection<Post> Creates { get; set; } = [];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The DNS records to overwrite.
|
/// The DNS records to overwrite.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IReadOnlyCollection<Put>? Overwrites { get; set; }
|
public IReadOnlyCollection<Put> Overwrites { get; set; } = [];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a request to update a DNS record.
|
/// Represents a request to update a DNS record.
|
||||||
|
|||||||
@@ -165,6 +165,34 @@ namespace Cloudflare.Core.Tests.CloudflareClientTests
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[DataTestMethod]
|
||||||
|
[DataRow(HttpStatusCode.Unauthorized)]
|
||||||
|
[DataRow(HttpStatusCode.Forbidden)]
|
||||||
|
public async Task ShouldThrowAuthenticationExceptionOnStatusCodeWithoutErrors(HttpStatusCode statusCode)
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
_httpHandlerMock.Responses.Enqueue(new HttpResponseMessage
|
||||||
|
{
|
||||||
|
StatusCode = statusCode,
|
||||||
|
Content = new StringContent(@"{""success"": false, ""errors"": null, ""messages"": []}", Encoding.UTF8, MediaTypeNames.Application.Json),
|
||||||
|
});
|
||||||
|
|
||||||
|
var client = GetClient();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Act
|
||||||
|
await client.GetAsync<TestClass>("foo");
|
||||||
|
Assert.Fail();
|
||||||
|
}
|
||||||
|
catch (AuthenticationException ex)
|
||||||
|
{
|
||||||
|
// Assert
|
||||||
|
Assert.IsNull(ex.InnerException);
|
||||||
|
Assert.AreEqual(string.Empty, ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
[DataTestMethod]
|
||||||
[DataRow(HttpStatusCode.Unauthorized)]
|
[DataRow(HttpStatusCode.Unauthorized)]
|
||||||
[DataRow(HttpStatusCode.Forbidden)]
|
[DataRow(HttpStatusCode.Forbidden)]
|
||||||
|
|||||||
@@ -720,6 +720,25 @@ namespace Cloudflare.Dns.Tests.DnsRecordsExtensions
|
|||||||
|
|
||||||
#region LOC
|
#region LOC
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public async Task ShouldCreateLocDataRecordWithoutLatitudeDegrees()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
((LOCRecordData)_request.Data).LatitudeDegrees = null;
|
||||||
|
var client = GetClient();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var response = await client.CreateDnsRecord(_request);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.IsNotNull(response);
|
||||||
|
Assert.IsTrue(response.Success);
|
||||||
|
Assert.AreEqual(_response.Result, response.Result);
|
||||||
|
|
||||||
|
_clientMock.Verify(m => m.PostAsync<DnsRecord, InternalDnsRecordRequest>($"/zones/{ZoneId}/dns_records", It.IsAny<InternalDnsRecordRequest>(), null, It.IsAny<CancellationToken>()), Times.Once);
|
||||||
|
_clientMock.VerifyNoOtherCalls();
|
||||||
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
[DataTestMethod]
|
||||||
[DataRow(-1)]
|
[DataRow(-1)]
|
||||||
[DataRow(91)]
|
[DataRow(91)]
|
||||||
@@ -736,6 +755,25 @@ namespace Cloudflare.Dns.Tests.DnsRecordsExtensions
|
|||||||
// Assert - ArgumentOutOfRangeException
|
// Assert - ArgumentOutOfRangeException
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public async Task ShouldCreateLocDataRecordWithoutLatitudeMinutes()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
((LOCRecordData)_request.Data).LatitudeMinutes = null;
|
||||||
|
var client = GetClient();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var response = await client.CreateDnsRecord(_request);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.IsNotNull(response);
|
||||||
|
Assert.IsTrue(response.Success);
|
||||||
|
Assert.AreEqual(_response.Result, response.Result);
|
||||||
|
|
||||||
|
_clientMock.Verify(m => m.PostAsync<DnsRecord, InternalDnsRecordRequest>($"/zones/{ZoneId}/dns_records", It.IsAny<InternalDnsRecordRequest>(), null, It.IsAny<CancellationToken>()), Times.Once);
|
||||||
|
_clientMock.VerifyNoOtherCalls();
|
||||||
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
[DataTestMethod]
|
||||||
[DataRow(-1)]
|
[DataRow(-1)]
|
||||||
[DataRow(60)]
|
[DataRow(60)]
|
||||||
@@ -752,6 +790,25 @@ namespace Cloudflare.Dns.Tests.DnsRecordsExtensions
|
|||||||
// Assert - ArgumentOutOfRangeException
|
// Assert - ArgumentOutOfRangeException
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public async Task ShouldCreateLocDataRecordWithoutLatitudeSeconds()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
((LOCRecordData)_request.Data).LatitudeSeconds = null;
|
||||||
|
var client = GetClient();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var response = await client.CreateDnsRecord(_request);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.IsNotNull(response);
|
||||||
|
Assert.IsTrue(response.Success);
|
||||||
|
Assert.AreEqual(_response.Result, response.Result);
|
||||||
|
|
||||||
|
_clientMock.Verify(m => m.PostAsync<DnsRecord, InternalDnsRecordRequest>($"/zones/{ZoneId}/dns_records", It.IsAny<InternalDnsRecordRequest>(), null, It.IsAny<CancellationToken>()), Times.Once);
|
||||||
|
_clientMock.VerifyNoOtherCalls();
|
||||||
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
[DataTestMethod]
|
||||||
[DataRow(-1.0)]
|
[DataRow(-1.0)]
|
||||||
[DataRow(59.9991)]
|
[DataRow(59.9991)]
|
||||||
@@ -768,6 +825,25 @@ namespace Cloudflare.Dns.Tests.DnsRecordsExtensions
|
|||||||
// Assert - ArgumentOutOfRangeException
|
// Assert - ArgumentOutOfRangeException
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public async Task ShouldCreateLocDataRecordWithoutLatitudeDirection()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
((LOCRecordData)_request.Data).LatitudeDirection = null;
|
||||||
|
var client = GetClient();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var response = await client.CreateDnsRecord(_request);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.IsNotNull(response);
|
||||||
|
Assert.IsTrue(response.Success);
|
||||||
|
Assert.AreEqual(_response.Result, response.Result);
|
||||||
|
|
||||||
|
_clientMock.Verify(m => m.PostAsync<DnsRecord, InternalDnsRecordRequest>($"/zones/{ZoneId}/dns_records", It.IsAny<InternalDnsRecordRequest>(), null, It.IsAny<CancellationToken>()), Times.Once);
|
||||||
|
_clientMock.VerifyNoOtherCalls();
|
||||||
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||||
public async Task ShouldThrowArgumentOutOfRangeExceptionForLocDataLatitudeDirection()
|
public async Task ShouldThrowArgumentOutOfRangeExceptionForLocDataLatitudeDirection()
|
||||||
@@ -782,6 +858,25 @@ namespace Cloudflare.Dns.Tests.DnsRecordsExtensions
|
|||||||
// Assert - ArgumentOutOfRangeException
|
// Assert - ArgumentOutOfRangeException
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public async Task ShouldCreateLocDataRecordWithoutLongitudeDegrees()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
((LOCRecordData)_request.Data).LongitudeDegrees = null;
|
||||||
|
var client = GetClient();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var response = await client.CreateDnsRecord(_request);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.IsNotNull(response);
|
||||||
|
Assert.IsTrue(response.Success);
|
||||||
|
Assert.AreEqual(_response.Result, response.Result);
|
||||||
|
|
||||||
|
_clientMock.Verify(m => m.PostAsync<DnsRecord, InternalDnsRecordRequest>($"/zones/{ZoneId}/dns_records", It.IsAny<InternalDnsRecordRequest>(), null, It.IsAny<CancellationToken>()), Times.Once);
|
||||||
|
_clientMock.VerifyNoOtherCalls();
|
||||||
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
[DataTestMethod]
|
||||||
[DataRow(-1)]
|
[DataRow(-1)]
|
||||||
[DataRow(181)]
|
[DataRow(181)]
|
||||||
@@ -798,6 +893,25 @@ namespace Cloudflare.Dns.Tests.DnsRecordsExtensions
|
|||||||
// Assert - ArgumentOutOfRangeException
|
// Assert - ArgumentOutOfRangeException
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public async Task ShouldCreateLocDataRecordWithoutLongitudeMinutes()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
((LOCRecordData)_request.Data).LongitudeMinutes = null;
|
||||||
|
var client = GetClient();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var response = await client.CreateDnsRecord(_request);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.IsNotNull(response);
|
||||||
|
Assert.IsTrue(response.Success);
|
||||||
|
Assert.AreEqual(_response.Result, response.Result);
|
||||||
|
|
||||||
|
_clientMock.Verify(m => m.PostAsync<DnsRecord, InternalDnsRecordRequest>($"/zones/{ZoneId}/dns_records", It.IsAny<InternalDnsRecordRequest>(), null, It.IsAny<CancellationToken>()), Times.Once);
|
||||||
|
_clientMock.VerifyNoOtherCalls();
|
||||||
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
[DataTestMethod]
|
||||||
[DataRow(-1)]
|
[DataRow(-1)]
|
||||||
[DataRow(60)]
|
[DataRow(60)]
|
||||||
@@ -814,6 +928,25 @@ namespace Cloudflare.Dns.Tests.DnsRecordsExtensions
|
|||||||
// Assert - ArgumentOutOfRangeException
|
// Assert - ArgumentOutOfRangeException
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public async Task ShouldCreateLocDataRecordWithoutLongitudeSeconds()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
((LOCRecordData)_request.Data).LongitudeSeconds = null;
|
||||||
|
var client = GetClient();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var response = await client.CreateDnsRecord(_request);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.IsNotNull(response);
|
||||||
|
Assert.IsTrue(response.Success);
|
||||||
|
Assert.AreEqual(_response.Result, response.Result);
|
||||||
|
|
||||||
|
_clientMock.Verify(m => m.PostAsync<DnsRecord, InternalDnsRecordRequest>($"/zones/{ZoneId}/dns_records", It.IsAny<InternalDnsRecordRequest>(), null, It.IsAny<CancellationToken>()), Times.Once);
|
||||||
|
_clientMock.VerifyNoOtherCalls();
|
||||||
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
[DataTestMethod]
|
||||||
[DataRow(-1.0)]
|
[DataRow(-1.0)]
|
||||||
[DataRow(59.9991)]
|
[DataRow(59.9991)]
|
||||||
@@ -830,6 +963,25 @@ namespace Cloudflare.Dns.Tests.DnsRecordsExtensions
|
|||||||
// Assert - ArgumentOutOfRangeException
|
// Assert - ArgumentOutOfRangeException
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public async Task ShouldCreateLocDataRecordWithoutLongitudeDirection()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
((LOCRecordData)_request.Data).LongitudeDirection = null;
|
||||||
|
var client = GetClient();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var response = await client.CreateDnsRecord(_request);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.IsNotNull(response);
|
||||||
|
Assert.IsTrue(response.Success);
|
||||||
|
Assert.AreEqual(_response.Result, response.Result);
|
||||||
|
|
||||||
|
_clientMock.Verify(m => m.PostAsync<DnsRecord, InternalDnsRecordRequest>($"/zones/{ZoneId}/dns_records", It.IsAny<InternalDnsRecordRequest>(), null, It.IsAny<CancellationToken>()), Times.Once);
|
||||||
|
_clientMock.VerifyNoOtherCalls();
|
||||||
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||||
public async Task ShouldThrowArgumentOutOfRangeExceptionForLocDataLongitudeDirection()
|
public async Task ShouldThrowArgumentOutOfRangeExceptionForLocDataLongitudeDirection()
|
||||||
@@ -844,6 +996,25 @@ namespace Cloudflare.Dns.Tests.DnsRecordsExtensions
|
|||||||
// Assert - ArgumentOutOfRangeException
|
// Assert - ArgumentOutOfRangeException
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public async Task ShouldCreateLocDataRecordWithoutAltitude()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
((LOCRecordData)_request.Data).Altitude = null;
|
||||||
|
var client = GetClient();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var response = await client.CreateDnsRecord(_request);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.IsNotNull(response);
|
||||||
|
Assert.IsTrue(response.Success);
|
||||||
|
Assert.AreEqual(_response.Result, response.Result);
|
||||||
|
|
||||||
|
_clientMock.Verify(m => m.PostAsync<DnsRecord, InternalDnsRecordRequest>($"/zones/{ZoneId}/dns_records", It.IsAny<InternalDnsRecordRequest>(), null, It.IsAny<CancellationToken>()), Times.Once);
|
||||||
|
_clientMock.VerifyNoOtherCalls();
|
||||||
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
[DataTestMethod]
|
||||||
[DataRow(-100_000.1)]
|
[DataRow(-100_000.1)]
|
||||||
[DataRow(42_849_672.951)]
|
[DataRow(42_849_672.951)]
|
||||||
@@ -860,6 +1031,25 @@ namespace Cloudflare.Dns.Tests.DnsRecordsExtensions
|
|||||||
// Assert - ArgumentOutOfRangeException
|
// Assert - ArgumentOutOfRangeException
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public async Task ShouldCreateLocDataRecordWithoutSize()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
((LOCRecordData)_request.Data).Size = null;
|
||||||
|
var client = GetClient();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var response = await client.CreateDnsRecord(_request);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.IsNotNull(response);
|
||||||
|
Assert.IsTrue(response.Success);
|
||||||
|
Assert.AreEqual(_response.Result, response.Result);
|
||||||
|
|
||||||
|
_clientMock.Verify(m => m.PostAsync<DnsRecord, InternalDnsRecordRequest>($"/zones/{ZoneId}/dns_records", It.IsAny<InternalDnsRecordRequest>(), null, It.IsAny<CancellationToken>()), Times.Once);
|
||||||
|
_clientMock.VerifyNoOtherCalls();
|
||||||
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
[DataTestMethod]
|
||||||
[DataRow(-1)]
|
[DataRow(-1)]
|
||||||
[DataRow(90_000_001)]
|
[DataRow(90_000_001)]
|
||||||
@@ -876,6 +1066,25 @@ namespace Cloudflare.Dns.Tests.DnsRecordsExtensions
|
|||||||
// Assert - ArgumentOutOfRangeException
|
// Assert - ArgumentOutOfRangeException
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public async Task ShouldCreateLocDataRecordWithoutPrecisionHorizontal()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
((LOCRecordData)_request.Data).PrecisionHorizontal = null;
|
||||||
|
var client = GetClient();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var response = await client.CreateDnsRecord(_request);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.IsNotNull(response);
|
||||||
|
Assert.IsTrue(response.Success);
|
||||||
|
Assert.AreEqual(_response.Result, response.Result);
|
||||||
|
|
||||||
|
_clientMock.Verify(m => m.PostAsync<DnsRecord, InternalDnsRecordRequest>($"/zones/{ZoneId}/dns_records", It.IsAny<InternalDnsRecordRequest>(), null, It.IsAny<CancellationToken>()), Times.Once);
|
||||||
|
_clientMock.VerifyNoOtherCalls();
|
||||||
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
[DataTestMethod]
|
||||||
[DataRow(-1)]
|
[DataRow(-1)]
|
||||||
[DataRow(90_000_001)]
|
[DataRow(90_000_001)]
|
||||||
@@ -892,6 +1101,25 @@ namespace Cloudflare.Dns.Tests.DnsRecordsExtensions
|
|||||||
// Assert - ArgumentOutOfRangeException
|
// Assert - ArgumentOutOfRangeException
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public async Task ShouldCreateLocDataRecordWithoutPrecisionVertical()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
((LOCRecordData)_request.Data).PrecisionVertical = null;
|
||||||
|
var client = GetClient();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var response = await client.CreateDnsRecord(_request);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.IsNotNull(response);
|
||||||
|
Assert.IsTrue(response.Success);
|
||||||
|
Assert.AreEqual(_response.Result, response.Result);
|
||||||
|
|
||||||
|
_clientMock.Verify(m => m.PostAsync<DnsRecord, InternalDnsRecordRequest>($"/zones/{ZoneId}/dns_records", It.IsAny<InternalDnsRecordRequest>(), null, It.IsAny<CancellationToken>()), Times.Once);
|
||||||
|
_clientMock.VerifyNoOtherCalls();
|
||||||
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
[DataTestMethod]
|
||||||
[DataRow(-1)]
|
[DataRow(-1)]
|
||||||
[DataRow(90_000_001)]
|
[DataRow(90_000_001)]
|
||||||
|
|||||||
@@ -95,12 +95,13 @@ namespace Cloudflare.Zones.Tests.ZonesExtensions
|
|||||||
}
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
[DataTestMethod]
|
||||||
[DataRow(null)]
|
[DataRow(null, ZoneType.Full)]
|
||||||
[DataRow("023e105f4ecef8ad9ca31a8372d0c353")]
|
[DataRow("023e105f4ecef8ad9ca31a8372d0c353", null)]
|
||||||
public async Task ShouldCreateZone(string accountId)
|
public async Task ShouldCreateZone(string accountId, ZoneType? type)
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
_request.AccountId = accountId;
|
_request.AccountId = accountId;
|
||||||
|
_request.Type = type;
|
||||||
var client = GetClient();
|
var client = GetClient();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
|
|||||||
Reference in New Issue
Block a user