Exemplo n.º 1
0
        public void AddLinkCommand_Valid()
        {
            var command = new AddLinkCommand()
            {
                Name = "Google",
                Url  = "http://www.google.com"
            };

            var validator = new AddLinkCommandValidator();
            var valid     = validator.Validate(command);

            Assert.True(valid);
        }
Exemplo n.º 2
0
        public void AddLinkCommand_InValid()
        {
            var command = new AddLinkCommand()
            {
                Name = null,
                Url  = "http://www.google.com"
            };

            var validator = new AddLinkCommandValidator();
            var valid     = validator.Validate(command);

            Assert.False(valid);
        }
Exemplo n.º 3
0
        public void AddLinkCommand_Valid()
        {
            var addLinkCommand = new AddLinkCommand()
            {
                Name = "Google",
                Url  = "http://www.google.com"
            };
            var urlValidator  = new UrlValidator();
            var nameValidator = new NameValidator(maxLength: 100);

            nameValidator.Next(urlValidator);

            var validator = new AddLinkCommandValidator(nameValidator);

            var valid = validator.Validate(addLinkCommand);

            Assert.True(valid);
        }
Exemplo n.º 4
0
        public void AddLinkCommand_Invalid()
        {
            var addLinkCommand = new AddLinkCommand()
            {
                Name = "Google",
                Url  = "invalid url"
            };
            var urlValidator  = new UrlValidator();
            var nameValidator = new NameValidator(100);

            nameValidator.Next(urlValidator);

            var validator = new AddLinkCommandValidator(nameValidator);

            var valid = validator.Validate(addLinkCommand);

            Assert.False(valid);
        }