public void ShouldAllowNestingValidatorsForComplexPropertyValues()
        {
            var val = ValidatorFactory.GetValidator <ComplexTestable>();
            var t1  = new ComplexTestable {
                Id = Guid.NewGuid(), Name = new Name {
                    First = "one", Last = "two"
                }
            };
            var t2 = new ComplexTestable {
                Id = t1.Id, Name = new Name {
                    First = "one", Last = "two"
                }
            };

            val.WithChildValidator <Name, Name>("Name", "Name");

            var exec = val.Against(t1);

            exec.Validate(t2);

            try
            {
                var t3 = new ComplexTestable {
                    Id = t1.Id, Name = new Name {
                        First = "three", Last = "four"
                    }
                };
                exec.Validate(t3);
                Assert.Fail("Expected an AssertFailedException from the result validator");
            }
            catch (AssertFailedException e)
            {
                Assert.IsInstanceOfType(e, typeof(AssertFailedException));
            }
        }
        public void ShouldAllowComparingDifferentTypes()
        {
            var val = ValidatorFactory.GetValidator <Testable, ComplexTestable>();
            var t1  = new ComplexTestable {
                Id = Guid.NewGuid(), Name = new Name {
                    First = "Foo", Last = "Bar"
                }
            };
            var t2 = new Testable {
                Id = t1.Id, Name = $"{t1.Name.First} {t1.Name.Last}"
            };
            var t3 = new Testable {
                Id = t1.Id, Name = "Not Valid"
            };

            val.WithMapping("Name", "Name", (p) => p.ToString());
            var exec = val.Against(t1);

            exec.Validate(t2);

            try
            {
                exec.Validate(t3);
                Assert.Fail("Expected an AssertFailedException from the result validator");
            }
            catch (AssertFailedException e)
            {
                Assert.IsInstanceOfType(e, typeof(AssertFailedException));
            }

            var r1 = exec.TryValidate(t2);

            Assert.IsTrue(r1.IsValid);
            Assert.AreEqual(0, r1.FailureList.Length);

            var r2 = exec.TryValidate(t3);

            Assert.IsFalse(r2.IsValid);
            Assert.AreEqual(1, r2.FailureList.Length);
        }