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

      Assert.AreSame(inner, testException.InnerException);
    }
        public void TestDefaultConstructor()
        {
            PermissionDeniedException testException = new PermissionDeniedException();

            string testExceptionString = testException.ToString();

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

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

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

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

        Assert.IsInstanceOf<PermissionDeniedException>(exception2);
        Assert.AreEqual(
          exception1.Message, ((PermissionDeniedException)exception2).Message
        );
      }
    }
        public void TestSerialization()
        {
            BinaryFormatter formatter = new BinaryFormatter();

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

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

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

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