public void Constructor()
        {
            string targetName = "name";
            string validation = "validation";

            var exception = new ValidationFailedException(targetName, validation);

            Assert.AreEqual(targetName, exception.TargetName);
            Assert.AreEqual(validation, exception.Validation);
        }
        public void Constructor_EmptyValidation()
        {
            string targetName = "name";
            string validation = string.Empty;

            try
            {
                var exception = new ValidationFailedException(targetName, validation);
            }
            catch (ArgumentException e)
            {
                Assert.AreEqual("validation", e.ParamName);
                throw;
            }
        }
        public void Constructor_NullName()
        {
            string targetName = null;
            string validation = "validation";

            try
            {
                var exception = new ValidationFailedException(targetName, validation);
            }
            catch (ArgumentException e)
            {
                Assert.AreEqual("targetName", e.ParamName);
                throw;
            }
        }
        public void SerializationConstructor_InnerException()
        {
            var inner = new Exception("innerExceptionMessage");

            var input = new ValidationFailedException("targetNameValue", "validationValue", inner);

            var stream = new MemoryStream();
            var formatter = new BinaryFormatter();

            formatter.Serialize(stream, input);

            stream.Seek(0, SeekOrigin.Begin);

            var output = (ValidationFailedException)formatter.Deserialize(stream);

            Assert.IsFalse(object.ReferenceEquals(input, output));
            Assert.AreEqual(input.TargetName, output.TargetName);
            Assert.AreEqual(input.Validation, output.Validation);
            Assert.IsNotNull(output.InnerException);
            Assert.IsFalse(object.ReferenceEquals(output.InnerException, inner));
            Assert.AreEqual(inner.Message, output.InnerException.Message);
        }
        public void GetObjectData_NullInfo()
        {
            var exception = new ValidationFailedException("asdf", "asdf");

            try
            {
                exception.GetObjectData(null, new StreamingContext());
            }
            catch (ArgumentNullException e)
            {
                Assert.AreEqual("info", e.ParamName);
                throw;
            }
        }
        public void GetObjectData()
        {
            var info = new SerializationInfo(typeof(ValidationFailedException), new FormatterConverter());
            var context = new StreamingContext();

            var exception = new ValidationFailedException("targetNameValue", "validationValue");

            exception.GetObjectData(info, context);

            Assert.AreEqual("targetNameValue", info.GetString("targetName"));
            Assert.AreEqual("validationValue", info.GetString("validation"));
        }