public void FailsWhenUserIdentEmpty()
        {
            var request   = new UpdateListRequest(null, "");
            var validator = new UpdateListValidator();
            var failures  = validator.ShouldHaveValidationErrorFor(r => r.UserIdent, request);

            Assert.AreEqual(1, failures.Count());
            Assert.AreEqual("UserIdent must not be empty", failures.First().ErrorMessage);
        }
        public void PassesOnSetUserIdent()
        {
            const string USER    = "******";
            var          request = new UpdateListRequest(null, USER);

            var validator = new UpdateListValidator();

            validator.ShouldNotHaveValidationErrorFor(r => r.UserIdent, request);
        }
        public void FailsWhenIdNull()
        {
            const string USER      = "******";
            var          request   = new UpdateListRequest(new ListDTO(), USER);
            var          validator = new UpdateListValidator();
            var          failures  = validator.ShouldHaveValidationErrorFor(r => r.DTO.Id, request);

            Assert.AreEqual(1, failures.Count());
            Assert.AreEqual("DTO Id must not be empty", failures.First().ErrorMessage);
        }
        public void PassesWhenIdSet()
        {
            const string USER    = "******";
            var          request = new UpdateListRequest(new ListDTO
            {
                Id = "a"
            }, USER);
            var validator = new UpdateListValidator();

            validator.ShouldNotHaveValidationErrorFor(r => r.DTO.Id, request);
        }
        public void FailsOnListItemDTONullId()
        {
            const string USER    = "******";
            var          request = new UpdateListRequest(new ListDTO
            {
                Items = new List <ListItemDTO>
                {
                    new ListItemDTO()
                }
            }, USER);

            var validator = new UpdateListValidator();
            var result    = validator.TestValidate(request);
            var failures  = result.ShouldHaveValidationErrorFor("DTO.Items[0].Id");

            Assert.AreEqual(1, failures.Count());
            Assert.AreEqual("List Item Id must not be empty", failures.First().ErrorMessage);
        }
        public void PassesOnSetItemId()
        {
            const string USER    = "******";
            var          request = new UpdateListRequest(new ListDTO
            {
                Items = new List <ListItemDTO>
                {
                    new ListItemDTO
                    {
                        Id = "a"
                    }
                }
            }, USER);

            var validator = new UpdateListValidator();
            var result    = validator.TestValidate(request);

            result.ShouldNotHaveValidationErrorFor("DTO.Items[0].Id");
        }