Skip to content

Commit

Permalink
Added error test for get DNS records
Browse files Browse the repository at this point in the history
  • Loading branch information
JSkimming committed Aug 26, 2015
1 parent bdbac15 commit 7d2cf6e
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/Tests/CloudFlare.NET.Tests/DnsRecordClientSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,32 @@ public class When_getting_dnsRecords : RequestContext

It should_make_a_GET_request = () => _handler.Request.Method.ShouldEqual(HttpMethod.Get);

It should_request_the_zones_endpoint = () => _handler.Request.RequestUri.ShouldEqual(_expectedRequestUri);
It should_request_the_DNS_records_endpoint = () => _handler.Request.RequestUri.ShouldEqual(_expectedRequestUri);

It should_return_the_expected_zones = () =>
_actual.Select(z => z.AsLikeness().CreateProxy()).SequenceEqual(_expected).ShouldBeTrue();
}

[Subject(typeof(CloudFlareClient))]
public class When_getting_dnsRecords_and_an_error_occurs : ErredRequestContext
{
static IdentifierTag _zoneId;
static Uri _expectedRequestUri;

Establish context = () =>
{
_zoneId = _fixture.Create<IdentifierTag>();
_expectedRequestUri = new Uri(CloudFlareConstants.BaseUri, $"zones/{_zoneId}/dns_records");
};

Because of = () => _exception = Catch.Exception(() => _sut.GetDnsRecordsAsync(_zoneId, _auth).Await());

Behaves_like<AuthenticatedRequestBehaviour> authenticated_request_behaviour;

Behaves_like<ErredRequestBehaviour> erred_request_behaviour;

It should_make_a_GET_request = () => _handler.Request.Method.ShouldEqual(HttpMethod.Get);

It should_request_the_DNS_records_endpoint = () => _handler.Request.RequestUri.ShouldEqual(_expectedRequestUri);
}
}

0 comments on commit 7d2cf6e

Please sign in to comment.