public void TestInnerException() {
      Exception inner = new Exception("This is a test");
      OutOfSpaceException testException = new OutOfSpaceException(
        "Hello World", inner
      );

      Assert.AreSame(inner, testException.InnerException);
    }
Пример #2
0
        public void TestDefaultConstructor()
        {
            OutOfSpaceException testException = new OutOfSpaceException();

            string testExceptionString = testException.ToString();

            Assert.IsNotNull(testExceptionString);
        }
Пример #3
0
        public void TestInnerException()
        {
            Exception           inner         = new Exception("This is a test");
            OutOfSpaceException testException = new OutOfSpaceException(
                "Hello World", inner
                );

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

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

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

        Assert.IsInstanceOf<OutOfSpaceException>(exception2);
        Assert.AreEqual(
          exception1.Message, ((OutOfSpaceException)exception2).Message
        );
      }
    }
Пример #5
0
        public void TestSerialization()
        {
            BinaryFormatter formatter = new BinaryFormatter();

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

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

                Assert.IsInstanceOf <OutOfSpaceException>(exception2);
                Assert.AreEqual(
                    exception1.Message, ((OutOfSpaceException)exception2).Message
                    );
            }
        }
    public void TestDefaultConstructor() {
      OutOfSpaceException testException = new OutOfSpaceException();

      string testExceptionString = testException.ToString();
      Assert.IsNotNull(testExceptionString);
    }