Ejemplo n.º 1
0
        public void TestConstructor1()
        {
            UnknownMessageFormatException ose = new UnknownMessageFormatException();

            Assert.IsTrue(ose is ApplicationException,
                          "UnknownMessageFormatException does not derive from ApplicationException");
        }
Ejemplo n.º 2
0
        public void TestConstructor2()
        {
            UnknownMessageFormatException ose = new UnknownMessageFormatException("abc");

            Assert.IsTrue(ose is ApplicationException,
                          "UnknownMessageFormatException does not derive from ApplicationException");
            Assert.AreEqual(ose.Message, "abc", "Wrong constructor implementation");
        }
Ejemplo n.º 3
0
        public void ConstructorSerializationTest()
        {
            BinaryFormatter bf     = new BinaryFormatter();
            MemoryStream    stream = new MemoryStream();

            UnknownMessageFormatException ex1 = new UnknownMessageFormatException("Failed");

            bf.Serialize(stream, ex1);

            stream.Flush();
            stream.Seek(0, SeekOrigin.Begin);

            UnknownMessageFormatException ex2 = (UnknownMessageFormatException)bf.Deserialize(stream);

            Assert.AreEqual(ex1.Message, ex2.Message, "Error message should be correct.");
        }