Esempio n. 1
0
        public void TestDefaultConstructor()
        {
            AbortedException testException = new AbortedException();

            string testExceptionString = testException.ToString();

            Assert.IsNotNull(testExceptionString);
        }
Esempio n. 2
0
        public void TestInnerException()
        {
            Exception        inner         = new Exception("This is a test");
            AbortedException testException = new AbortedException(
                "Hello World", inner
                );

            Assert.AreSame(inner, testException.InnerException);
        }
Esempio n. 3
0
        public void TestSerialization()
        {
            BinaryFormatter formatter = new BinaryFormatter();

            using (MemoryStream memory = new MemoryStream()) {
                AbortedException exception1 = new AbortedException("Hello World");

                formatter.Serialize(memory, exception1);
                memory.Position = 0;
                object exception2 = formatter.Deserialize(memory);

                Assert.IsInstanceOf <AbortedException>(exception2);
                Assert.AreEqual(exception1.Message, ((AbortedException)exception2).Message);
            }
        }