public void UsingTheConstructorWithMessageReturnsExceptionWithExpectedProperties()
        {
            var sut = new StreamSourceException("Message");

            Assert.That(sut.Message, Is.EqualTo("Message"));
            Assert.That(sut.InnerException, Is.Null);
        }
        public void UsingTheConstructorWithMessageReturnsExceptionWithExpectedProperties()
        {
            var sut = new StreamSourceException("Message");

            Assert.That(sut.Message, Is.EqualTo("Message"));
            Assert.That(sut.InnerException, Is.Null);
        }
        public void UsingTheDefaultConstructorReturnsExceptionWithExpectedProperties()
        {
            var sut = new StreamSourceException();

            //Use of Contains.Substring due to differences in OS.
            Assert.That(sut.Message, Contains.Substring(typeof(StreamSourceException).Name));
            Assert.That(sut.InnerException, Is.Null);
        }
        public void UsingTheDefaultConstructorReturnsExceptionWithExpectedProperties()
        {
            var sut = new StreamSourceException();

            //Use of Contains.Substring due to differences in OS.
            Assert.That(sut.Message, Contains.Substring(typeof (StreamSourceException).Name));
            Assert.That(sut.InnerException, Is.Null);
        }
        public void CanBeSerialized()
        {
            var innerException = new Exception("InnerMessage");
            var sut            = new StreamSourceException("Message", innerException);

            using (var stream = new MemoryStream())
            {
                var formatter = new BinaryFormatter();
                formatter.Serialize(stream, sut);
                stream.Position = 0;
                var result = (StreamSourceException)formatter.Deserialize(stream);

                Assert.That(sut.Message, Is.EqualTo(result.Message));
                Assert.That(sut.InnerException.Message, Is.EqualTo(result.InnerException.Message));
            }
        }
        public void CanBeSerialized()
        {
            var innerException = new Exception("InnerMessage");
            var sut = new StreamSourceException("Message", innerException);

            using (var stream = new MemoryStream())
            {
                var formatter = new BinaryFormatter();
                formatter.Serialize(stream, sut);
                stream.Position = 0;
                var result = (StreamSourceException) formatter.Deserialize(stream);

                Assert.That(sut.Message, Is.EqualTo(result.Message));
                Assert.That(sut.InnerException.Message, Is.EqualTo(result.InnerException.Message));
            }
        }