public void when_calling_toString_with_configurationFile()
        {
            var sut = new ConfigurationException("test") { ConfigurationFile = "myConfigfile" };

            var toStr = sut.ToString();
            StringAssert.Contains(toStr, "test");
            StringAssert.Contains(toStr, "myConfigfile");
        }
        public void when_calling_toString()
        {
            List<Exception> inners = new List<Exception>();
            inners.Add(new ArgumentException("Msg1"));
            inners.Add(new InvalidOperationException("Inv2"));
            inners.Add(new XmlSchemaValidationException("Validation", new Exception("inner"), 111, 222));

            var sut = new ConfigurationException(inners);
            var toStr = sut.ToString();

            StringAssert.Contains(toStr, "Msg1");
            StringAssert.Contains(toStr, "Inv2");
            StringAssert.Contains(toStr, "Validation");
            StringAssert.Contains(toStr, "inner");
            StringAssert.Contains(toStr, "111");
            StringAssert.Contains(toStr, "222");
        }
        public void when_serializing_with_inner_shoulld_deserialize_back()
        {
            List<Exception> inners = new List<Exception>();
            inners.Add(new ArgumentException("Msg1"));
            inners.Add(new InvalidOperationException("Inv2"));
            inners.Add(new XmlSchemaValidationException("Validation", new Exception("inner"), 111, 222));

            var sut = new ConfigurationException(inners);
            var str = sut.ToString();

            BinaryFormatter formatter = new BinaryFormatter();
            using (MemoryStream stream = new MemoryStream())
            {
                formatter.Serialize(stream, sut);
                stream.Position = 0;
                var deserialized = formatter.Deserialize(stream) as ConfigurationException;

                Assert.AreEqual(str, deserialized.ToString());
            }
        }