Exemplo n.º 1
0
        public void Unavailable_Success_Is_Succeeded()
        {
            var ringCopyResult        = PushFileResult.ServerUnavailable();
            var outsideRingCopyResult = PushFileResult.PushSucceeded();
            var result = new ProactiveCopyResult(ringCopyResult, outsideRingCopyResult, retries: 0);

            result.Succeeded.Should().BeTrue();
            ringCopyResult.Succeeded.Should().BeFalse();
            outsideRingCopyResult.Succeeded.Should().BeTrue();
            result.ToString().Should().Contain("Success");
            result.ToString().Should().Contain("Unavailable");
        }
Exemplo n.º 2
0
        public void Unavailable_Error_Is_Error()
        {
            var ringCopyResult        = PushFileResult.ServerUnavailable();
            var error                 = "my error";
            var outsideRingCopyResult = new PushFileResult(error);
            var result                = new ProactiveCopyResult(ringCopyResult, outsideRingCopyResult, retries: 0);

            result.Succeeded.Should().BeFalse();
            result.Status.Should().Be(ProactiveCopyStatus.Error);

            result.ToString().Should().Contain(ringCopyResult.Status.ToString());
            result.ToString().Should().Contain(outsideRingCopyResult.Status.ToString());
        }
Exemplo n.º 3
0
        public void Diabled_Succeeded_Is_Succeeded()
        {
            var ringCopyResult        = PushFileResult.Disabled();
            var outsideRingCopyResult = PushFileResult.PushSucceeded();
            var result = new ProactiveCopyResult(ringCopyResult, outsideRingCopyResult, retries: 0);

            result.Succeeded.Should().BeTrue();

            ringCopyResult.Succeeded.Should().BeFalse();
            outsideRingCopyResult.Succeeded.Should().BeTrue();
            result.ToString().Should().Contain("Success");
            result.ToString().Should().Contain("Disabled");
        }
Exemplo n.º 4
0
        public void Error_Succeeded_Is_Succeeded()
        {
            var myDiagnostics         = "My diagnostics";
            var myErrorMessage        = "My error message";
            var ringCopyResult        = new PushFileResult(myErrorMessage, myDiagnostics);
            var outsideRingCopyResult = PushFileResult.PushSucceeded();
            var result = new ProactiveCopyResult(ringCopyResult, outsideRingCopyResult, retries: 0);

            // Even if one of the operations is successful, the overall operation is successful.
            result.Succeeded.Should().BeTrue();
            result.ToString().Should().NotContain(myDiagnostics, "The final error should not have an error message. Only error status");
            result.ToString().Should().NotContain(myErrorMessage, "The final error should not have an error message. Only error status");
            result.ToString().Should().Contain(ringCopyResult.Status.ToString());
        }
Exemplo n.º 5
0
        public void Error_Reject_Is_Rejected()
        {
            string error                 = "my error";
            var    ringCopyResult        = new PushFileResult(error);
            var    outsideRingCopyResult = PushFileResult.Rejected(RejectionReason.OlderThanLastEvictedContent);
            var    result                = new ProactiveCopyResult(ringCopyResult, outsideRingCopyResult, retries: 0);

            result.Succeeded.Should().BeFalse();
            result.Status.Should().Be(ProactiveCopyStatus.Rejected);

            result.ToString().Should().NotContain("Success");
            result.ToString().Should().NotContain(error);
            result.ToString().Should().Contain(ringCopyResult.Status.ToString());
        }
Exemplo n.º 6
0
        public void Reject_Succeeded_Is_Succeeded()
        {
            var ringCopyResult        = PushFileResult.Rejected(RejectionReason.OlderThanLastEvictedContent);
            var outsideRingCopyResult = PushFileResult.PushSucceeded();
            var result = new ProactiveCopyResult(ringCopyResult, outsideRingCopyResult, retries: 0);

            // Even if one of the operations is successful, the overall operation is successful.
            result.Succeeded.Should().BeTrue();
            result.ToString().Should().Contain(ringCopyResult.Status.ToString());
        }
Exemplo n.º 7
0
        public void Reject_Reject_Is_Rejected()
        {
            var ringCopyResult        = PushFileResult.Rejected();
            var outsideRingCopyResult = PushFileResult.Rejected();
            var result = new ProactiveCopyResult(ringCopyResult, outsideRingCopyResult);

            result.Succeeded.Should().BeFalse();
            result.Status.Should().Be(ProactiveCopyStatus.Rejected);

            ringCopyResult.Succeeded.Should().BeFalse();
            result.ToString().Should().Contain(ringCopyResult.Status.ToString());
        }