Beispiel #1
0
        public async Task No_Records_Are_Successfully_Created_Returns_Failure()
        {
            IGoDaddyClient fakeClient = A.Fake <IGoDaddyClient>();

            A.CallTo(() => fakeClient.CreateDNSRecordsAsync(A <GoDaddyCreateDNSRecordsRequest> .Ignored, A <CancellationToken> .Ignored)).Returns(Result.Fail("oops"));

            GoDaddyDNSRecordCreator creator    = new GoDaddyDNSRecordCreator(fakeClient, _mapper);
            DNSRecordCollection     dnsRecords = new DNSRecordCollection(
                new DNSRecord
            {
                Type = DNSRecordType.A
            },
                new DNSRecord
            {
                Type = DNSRecordType.A
            });
            GoDaddyAuthenticationDetails authicationDetails = new GoDaddyAuthenticationDetails(string.Empty, string.Empty);

            Result result = await creator.CreateAsync(string.Empty, dnsRecords, authicationDetails, CancellationToken.None);

            Assert.True(result.IsFailed);
        }
Beispiel #2
0
        public async Task Records_Are_Created_And_Successful_Result_Returned()
        {
            IGoDaddyClient fakeClient = A.Fake <IGoDaddyClient>();

            A.CallTo(() => fakeClient.CreateDNSRecordsAsync(A <GoDaddyCreateDNSRecordsRequest> .Ignored, A <CancellationToken> .Ignored)).Returns(Result.Ok());

            GoDaddyDNSRecordCreator creator    = new GoDaddyDNSRecordCreator(fakeClient, _mapper);
            DNSRecordCollection     dnsRecords = new DNSRecordCollection(
                new DNSRecord
            {
                Type = DNSRecordType.A
            },
                new DNSRecord
            {
                Type = DNSRecordType.A
            });
            GoDaddyAuthenticationDetails authicationDetails = new GoDaddyAuthenticationDetails(string.Empty, string.Empty);

            Result result = await creator.CreateAsync(string.Empty, dnsRecords, authicationDetails, CancellationToken.None);

            Assert.True(result.IsSuccess);
            A.CallTo(() => fakeClient.CreateDNSRecordsAsync(A <GoDaddyCreateDNSRecordsRequest> .Ignored, A <CancellationToken> .Ignored)).MustHaveHappenedOnceExactly();
        }