Exemplo n.º 1
0
        public void ValidationFailed_WithCollectionOfErrors_ReturnResultWithSameInternalErrors()
        {
            var executionErrors = new[]
            {
                new ExecutionError(new ErrorCodeInfo(nameof(Core), FixtureUtils.String(), FixtureUtils.String())),
                new ExecutionError(new ErrorCodeInfo(nameof(Core), FixtureUtils.String(), FixtureUtils.String()))
            };

            var result = FailedResult.ValidationFailed(executionErrors);

            result.CodeInfo.Should().BeEquivalentTo(CoreErrorCodes.ValidationFailed);
            result.Details.Should().BeEquivalentTo <ExecutionError>(executionErrors);
        }
Exemplo n.º 2
0
        public void CreateWithInternal_Creates_2LevelError()
        {
            var externalCode = new ErrorCodeInfo(nameof(Core), FixtureUtils.String(), FixtureUtils.String());
            var internalCode = new ErrorCodeInfo(nameof(Core), FixtureUtils.String(), FixtureUtils.String());

            var result = FailedResult.Create(externalCode, internalCode);

            result.Code.Should().Be(externalCode.Code);
            result.Message.Should().Be(externalCode.Message);

            var internalError = result.Details.Single();

            internalError.Message.Should().Be(internalCode.Message);
            internalError.Code.Should().Be(internalCode.Code);
        }
        public void SuccessValue_Always_CreatesSuccessfulValueResult()
        {
            var value = FixtureUtils.String();

            Success(value).Should().BeEquivalentTo(new SuccessfulValueResult(value));
        }