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

      Assert.AreSame(inner, testException.InnerException);
    }
예제 #2
0
        public void TestDefaultConstructor()
        {
            ServerErrorException testException = new ServerErrorException();

            string testExceptionString = testException.ToString();

            Assert.IsNotNull(testExceptionString);
        }
예제 #3
0
        public void TestInnerException()
        {
            Exception            inner         = new Exception("This is a test");
            ServerErrorException testException = new ServerErrorException(
                "Hello World", inner
                );

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

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

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

        Assert.IsInstanceOf<ServerErrorException>(exception2);
        Assert.AreEqual(
          exception1.Message, ((ServerErrorException)exception2).Message
        );
      }
    }
예제 #5
0
        public void TestSerialization()
        {
            BinaryFormatter formatter = new BinaryFormatter();

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

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

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

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