public async Task ReturnsFailureWhenUpdateFails()
        {
            DNSRecordCollection dnsRecordCollection = DNSRecordCollection.Empty();
            DigitalOceanDomain  domain          = new DigitalOceanDomain();
            ExternalAddress     externalAddress = new ExternalAddress();

            IDNSRecordCollectionMutator dnsRecordMutator = A.Fake <IDNSRecordCollectionMutator>();

            A.CallTo(() => dnsRecordMutator.Mutate(A <DNSRecordCollection> .Ignored, A <IDNSRecordCollectionMutation> .Ignored)).Returns(dnsRecordCollection);

            IDigitalOceanDNSRecordCreator dnsRecordCreator = A.Fake <IDigitalOceanDNSRecordCreator>();

            A.CallTo(() => dnsRecordCreator.CreateAsync(A <string> .Ignored, A <DNSRecordCollection> .Ignored, A <string> .Ignored, A <CancellationToken> .Ignored)).Returns(Result.Ok());

            IDigitalOceanDNSRecordReader dnsRecordReader = A.Fake <IDigitalOceanDNSRecordReader>();

            A.CallTo(() => dnsRecordReader.ReadAsync(A <DigitalOceanDomain> .Ignored, A <string> .Ignored, A <CancellationToken> .Ignored)).Returns(Result.Ok(dnsRecordCollection));

            IDigitalOceanDNSRecordUpdater dnsRecordUpdater = A.Fake <IDigitalOceanDNSRecordUpdater>();

            A.CallTo(() => dnsRecordUpdater.UpdateAsync(A <string> .Ignored, A <DNSRecordCollection> .Ignored, A <string> .Ignored, A <CancellationToken> .Ignored)).Returns(Result.Fail("Error."));

            IDigitalOceanDomainProcessor processor = new DigitalOceanDomainProcessor(dnsRecordMutator, dnsRecordCreator, dnsRecordReader, dnsRecordUpdater);
            Result result = await processor.ProcessAsync(domain, externalAddress, string.Empty, new CancellationToken());

            Assert.True(result.IsFailed);
        }
        public async Task ProcessAsync_ReadFails_ReturnsFailureResult()
        {
            IGoDaddyDNSRecordCreator dnsCreator = A.Fake <IGoDaddyDNSRecordCreator>();

            A.CallTo(() => dnsCreator.CreateAsync(A <string> .Ignored, A <DNSRecordCollection> .Ignored, A <GoDaddyAuthenticationDetails> .Ignored, A <CancellationToken> .Ignored))
            .Returns(Result.Ok());

            IDNSRecordCollectionMutator mutator = A.Fake <IDNSRecordCollectionMutator>();

            A.CallTo(() => mutator.Mutate(A <DNSRecordCollection> .Ignored, A <IDNSRecordCollectionMutation> .Ignored))
            .Returns(DNSRecordCollection.Empty());

            IGoDaddyDNSRecordReader dnsReader = A.Fake <IGoDaddyDNSRecordReader>();

            A.CallTo(() => dnsReader.ReadAsync(A <string> .Ignored, A <GoDaddyAuthenticationDetails> .Ignored, A <CancellationToken> .Ignored))
            .Returns(Result.Fail("Reader Failure"));

            IGoDaddyDNSRecordUpdater dnsUpdater = A.Fake <IGoDaddyDNSRecordUpdater>();

            A.CallTo(() => dnsUpdater.UpdateAsync(A <string> .Ignored, A <DNSRecordCollection> .Ignored, A <GoDaddyAuthenticationDetails> .Ignored, A <CancellationToken> .Ignored))
            .Returns(Result.Ok());

            IGoDaddyDomainProcessor domainProcessor = new GoDaddyDomainProcessor(dnsCreator, mutator, dnsReader, dnsUpdater);

            GoDaddyDomain domain = new GoDaddyDomain()
            {
                Name = "GoDaddy Domain"
            };
            ExternalAddress externalAddress = A.Fake <ExternalAddress>();
            GoDaddyAuthenticationDetails authenticationDetails = A.Fake <GoDaddyAuthenticationDetails>();

            Result result = await domainProcessor.ProcessAsync(domain, externalAddress, authenticationDetails, new CancellationToken());

            Assert.False(result.IsSuccess);
            Assert.True(result.IsFailed);
        }