Exemplo n.º 1
0
        public void Should_have_validation_error_when_description_is_too_long()
        {
            var command = Fixture.Build <UpdateForum>().With(x => x.Description, new string('*', 201)).Create();

            var forumRules         = new Mock <IForumRules>();
            var permissionSetRules = new Mock <IPermissionSetRules>();

            var sut = new UpdateForumValidator(forumRules.Object, permissionSetRules.Object);

            sut.ShouldHaveValidationErrorFor(x => x.Description, command);
        }
Exemplo n.º 2
0
        public void Should_have_validation_error_when_name_is_empty()
        {
            var command = Fixture.Build <UpdateForum>().With(x => x.Name, string.Empty).Create();

            var forumRules         = new Mock <IForumRules>();
            var permissionSetRules = new Mock <IPermissionSetRules>();

            var sut = new UpdateForumValidator(forumRules.Object, permissionSetRules.Object);

            sut.ShouldHaveValidationErrorFor(x => x.Name, command);
        }
Exemplo n.º 3
0
        public void Should_have_validation_error_when_name_is_not_unique()
        {
            var command = Fixture.Create <UpdateForum>();

            var forumRules = new Mock <IForumRules>();

            forumRules.Setup(x => x.IsNameUniqueAsync(command.SiteId, command.CategoryId, command.Name, command.Id)).ReturnsAsync(false);

            var permissionSetRules = new Mock <IPermissionSetRules>();

            var sut = new UpdateForumValidator(forumRules.Object, permissionSetRules.Object);

            sut.ShouldHaveValidationErrorFor(x => x.Name, command);
        }
Exemplo n.º 4
0
        public void Should_have_validation_error_when_permission_set_is_not_valid()
        {
            var command = Fixture.Create <UpdateForum>();

            var forumRules = new Mock <IForumRules>();

            var permissionSetRules = new Mock <IPermissionSetRules>();

            permissionSetRules.Setup(x => x.IsValidAsync(command.SiteId, command.PermissionSetId.Value)).ReturnsAsync(false);

            var sut = new UpdateForumValidator(forumRules.Object, permissionSetRules.Object);

            sut.ShouldHaveValidationErrorFor(x => x.PermissionSetId, command);
        }