Exemplo n.º 1
0
        public void Ctor_CreatesException_WithGivenMessageAnInnerException()
        {
            var innerException = new Exception();
            var exception = new JobLoadException("1", innerException);

            Assert.Equal("1", exception.Message);
            Assert.Same(innerException, exception.InnerException);
        }
Exemplo n.º 2
0
        public void Instance_CanBeSerializedAndDeserialized()
        {
            var exception = new JobLoadException("1", new Exception());
            JobLoadException deserializedException;

            using (var stream = new MemoryStream())
            {
                var formatter = new BinaryFormatter();
                formatter.Serialize(stream, exception);

                stream.Position = 0;

                deserializedException = (JobLoadException) formatter.Deserialize(stream);
            }

            Assert.Equal("1", deserializedException.Message);
        }