コード例 #1
0
        public void ThrowsIfCommandIsInvalidButNotRequired()
        {
            var testCommand = new InvalidCommand {
                Invalid = true
            };

            Assert.Throws <ValidationException>(() => commandProcessor.Process(testCommand));
        }
コード例 #2
0
        public void ThrowsIfCommandIsInvalidButNotRequired()
        {
            var testCommand = new InvalidCommand {
                Invalid = true
            };

            commandProcessor.Process(testCommand);
        }
コード例 #3
0
        public void CanGetValidationResultsForInvalidCommand()
        {
            var command = new InvalidCommand();
            var results = command.ValidationResults();

            Assert.IsNotNull(results);
            Assert.AreEqual(1, results.Count);

            var enumerator = results.GetEnumerator();
            enumerator.MoveNext();
            Assert.AreEqual("The Invalid field is required.", enumerator.Current.ErrorMessage);
        }
コード例 #4
0
        public void CanGetValidationResultsForInvalidCommand()
        {
            var command = new InvalidCommand();
            var results = command.ValidationResults();

            Assert.IsNotNull(results);
            Assert.AreEqual(1, results.Count);

            var enumerator = results.GetEnumerator();

            enumerator.MoveNext();
            Assert.AreEqual("The Invalid field is required.", enumerator.Current.ErrorMessage);
        }
コード例 #5
0
        public void CanGetValidationResultsForInvalidCommand()
        {
            var command = new InvalidCommand();
            var results = command.ValidationResults();

            Assert.IsNotNull(results);
            Assert.AreEqual(2, results.Count);

            var enumerator = results.GetEnumerator();
            enumerator.MoveNext();
            //todo: the ErrorMessage maybe different in different culture.
            //Assert.AreEqual("The Invalid field is required.", enumerator.Current.ErrorMessage);

            enumerator.MoveNext();
            //todo: the ErrorMessage maybe different in different culture.
            //Assert.AreEqual("The field InvalidInt must be between 100 and 199.", enumerator.Current.ErrorMessage);
        }
コード例 #6
0
 public void IsValidReturnsFalseForInvalidCommand()
 {
     var command = new InvalidCommand();
     Assert.IsFalse(command.IsValid());
 }
コード例 #7
0
        public void ThrowsIfCommandIsInvalid()
        {
            var testCommand = new InvalidCommand();

            commandProcessor.Process(testCommand);
        }
コード例 #8
0
        public void IsValidReturnsFalseForInvalidCommand()
        {
            var command = new InvalidCommand();

            Assert.IsFalse(command.IsValid());
        }
コード例 #9
0
        public void ThrowsIfCommandIsInvalid()
        {
            var testCommand = new InvalidCommand();

            Assert.Throws <ValidationException>(() => commandProcessor.Process(testCommand));
        }