Example #1
0
        public async Task Returns_Success_When_All_Records_Update()
        {
            IGoDaddyClient client = A.Fake <IGoDaddyClient>();

            A.CallTo(() => client.UpdateDNSRecordAsync(A <GoDaddyUpdateDNSRecordsRequest> .Ignored, A <CancellationToken> .Ignored)).Returns(Result.Ok());

            GoDaddyDNSRecordUpdater      updater            = new GoDaddyDNSRecordUpdater(client, _mapper);
            DNSRecordCollection          records            = new DNSRecordCollection(CreateValidDNSRecord(1), CreateValidDNSRecord(2));
            GoDaddyAuthenticationDetails authicationDetails = new GoDaddyAuthenticationDetails("apiKey", "apiSecret");

            Result result = await updater.UpdateAsync("aDomain.com", records, authicationDetails, CancellationToken.None);

            Assert.True(result.IsSuccess);
        }
Example #2
0
        public async Task No_Records_Are_Successfully_Created_If_Client_Fails()
        {
            IGoDaddyClient client = A.Fake <IGoDaddyClient>();

            A.CallTo(() => client.UpdateDNSRecordAsync(A <GoDaddyUpdateDNSRecordsRequest> .Ignored, A <CancellationToken> .Ignored)).Returns(Result.Fail("Error"));

            GoDaddyDNSRecordUpdater      updater            = new GoDaddyDNSRecordUpdater(client, _mapper);
            DNSRecordCollection          records            = new DNSRecordCollection(CreateValidDNSRecord(1), CreateValidDNSRecord(2));
            GoDaddyAuthenticationDetails authicationDetails = new GoDaddyAuthenticationDetails("apiKey", "apiSecret");

            Result result = await updater.UpdateAsync("aDomain.com", records, authicationDetails, CancellationToken.None);

            Assert.True(result.IsFailed);
            Assert.Equal(2, result.Errors.Count);
        }