Enhanced easy to catch test coverage
This commit is contained in:
@@ -720,6 +720,25 @@ namespace Cloudflare.Dns.Tests.DnsRecordsExtensions
|
||||
|
||||
#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]
|
||||
[DataRow(-1)]
|
||||
[DataRow(91)]
|
||||
@@ -736,6 +755,25 @@ namespace Cloudflare.Dns.Tests.DnsRecordsExtensions
|
||||
// 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]
|
||||
[DataRow(-1)]
|
||||
[DataRow(60)]
|
||||
@@ -752,6 +790,25 @@ namespace Cloudflare.Dns.Tests.DnsRecordsExtensions
|
||||
// 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]
|
||||
[DataRow(-1.0)]
|
||||
[DataRow(59.9991)]
|
||||
@@ -768,6 +825,25 @@ namespace Cloudflare.Dns.Tests.DnsRecordsExtensions
|
||||
// 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]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
public async Task ShouldThrowArgumentOutOfRangeExceptionForLocDataLatitudeDirection()
|
||||
@@ -782,6 +858,25 @@ namespace Cloudflare.Dns.Tests.DnsRecordsExtensions
|
||||
// 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]
|
||||
[DataRow(-1)]
|
||||
[DataRow(181)]
|
||||
@@ -798,6 +893,25 @@ namespace Cloudflare.Dns.Tests.DnsRecordsExtensions
|
||||
// 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]
|
||||
[DataRow(-1)]
|
||||
[DataRow(60)]
|
||||
@@ -814,6 +928,25 @@ namespace Cloudflare.Dns.Tests.DnsRecordsExtensions
|
||||
// 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]
|
||||
[DataRow(-1.0)]
|
||||
[DataRow(59.9991)]
|
||||
@@ -830,6 +963,25 @@ namespace Cloudflare.Dns.Tests.DnsRecordsExtensions
|
||||
// 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]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
public async Task ShouldThrowArgumentOutOfRangeExceptionForLocDataLongitudeDirection()
|
||||
@@ -844,6 +996,25 @@ namespace Cloudflare.Dns.Tests.DnsRecordsExtensions
|
||||
// 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]
|
||||
[DataRow(-100_000.1)]
|
||||
[DataRow(42_849_672.951)]
|
||||
@@ -860,6 +1031,25 @@ namespace Cloudflare.Dns.Tests.DnsRecordsExtensions
|
||||
// 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]
|
||||
[DataRow(-1)]
|
||||
[DataRow(90_000_001)]
|
||||
@@ -876,6 +1066,25 @@ namespace Cloudflare.Dns.Tests.DnsRecordsExtensions
|
||||
// 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]
|
||||
[DataRow(-1)]
|
||||
[DataRow(90_000_001)]
|
||||
@@ -892,6 +1101,25 @@ namespace Cloudflare.Dns.Tests.DnsRecordsExtensions
|
||||
// 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]
|
||||
[DataRow(-1)]
|
||||
[DataRow(90_000_001)]
|
||||
|
||||
Reference in New Issue
Block a user