public void GivenValidData_WhenValidateUpdate_ThenReturnNoErrors()
        {
            var command = UpdateEvaluationByIdCommandFactory.ValidUpdateEvaluationCommand(_database.DbContext);

            var result = _validator.TestValidate(command);

            result.IsValid.Should().BeTrue();
            result.ShouldNotHaveAnyValidationErrors();
        }
        public void GivenDataWithNoScore_WhenValidateUpdate_ThenReturnErrors()
        {
            var command = UpdateEvaluationByIdCommandFactory.UpdateEvaluationCommandWithoutScore();

            var result = _validator.TestValidate(command);

            result.IsValid.Should().BeFalse();
            result.ShouldHaveValidationErrorFor(c => c.Scor)
            .WithErrorMessage(ValidationErrors.EmptyScor);
            result.ShouldNotHaveValidationErrorFor(evaluation => evaluation.UserId);
            result.ShouldNotHaveValidationErrorFor(evaluation => evaluation.ConsultantId);
        }
コード例 #3
0
        public async Task GivenEvaluationController_WhenUpdateIsCalled_ThenReturnNoContent()
        {
            var id      = ObjectId.GenerateNewId().ToString();
            var command = UpdateEvaluationByIdCommandFactory.ValidUpdateEvaluationByIdCommand(id);

            var result = await _controller.Update(command);

            var noContentResult = result as NoContentResult;

            noContentResult.Should().NotBeNull();
            noContentResult.StatusCode.Should().Be(204);
            A.CallTo(() => _mediator.Send(command, default)).MustHaveHappenedOnceExactly();
        }