コード例 #1
0
        public async Task PaymentPatch_WhenNull_MustReturnCorrespondentErrorMessage()
        {
            var validator = new PaymentPatchValidator();
            var result    = await validator.ValidateAsync((JsonPatchDocument <Payment>) null);

            result.Errors.Should().Contain(e => e.ErrorCode.Equals($"Null{typeof(JsonPatchDocument<Payment>).Name}"));
        }
コード例 #2
0
        public async Task PaymentPatch_WhenOperationOverSubmissionDate_MustReturnCorrespondentErrorMessage()
        {
            var validator     = new PaymentPatchValidator();
            var patchDocument = new JsonPatchDocument <Payment>().Replace(p => p.SubmissionDate, this.Fixture.Create <DateTime>());
            var result        = await validator.ValidateAsync(patchDocument);

            result.Errors.Should().Contain(e => e.ErrorCode.Equals("PaymentSubmissionDateOperationNotAllowed"));
        }
コード例 #3
0
        public async Task PaymentPatch_WhenMultipleInvalidOperations_MustReturnMultipleErrorMessages()
        {
            var validator     = new PaymentPatchValidator();
            var patchDocument = new JsonPatchDocument <Payment>()
                                .Replace(p => p.Id, this.Fixture.Create <Guid>())
                                .Replace(p => p.SubmissionDate, this.Fixture.Create <DateTime>());
            var result = await validator.ValidateAsync(patchDocument);

            result.Errors.Should().HaveCountGreaterThan(1);
        }