Exemple #1
0
        public void SerializationTest()
        {
            const string argument = "Argument";
            const string message = "message";
            const string innerMessage = "Inner exception";
            var innerException = new Exception(innerMessage);
            var exception = new UnknownArgumentException(argument, message, innerException);

            using (var memoryStream = new MemoryStream())
            {
                // Serialize exception.
                var formatter = new BinaryFormatter();
                formatter.Serialize(memoryStream, exception);

                memoryStream.Position = 0;

                // Deserialize exception.
                formatter = new BinaryFormatter();
                var deserializedException = (UnknownArgumentException)formatter.Deserialize(memoryStream);

                Assert.AreEqual(argument, deserializedException.Argument);
                Assert.AreEqual(message, deserializedException.Message);
                Assert.AreEqual(innerMessage, deserializedException.InnerException.Message);
            }
        }
Exemple #2
0
        public void SerializationTest()
        {
            const string argument       = "Argument";
            const string message        = "message";
            const string innerMessage   = "Inner exception";
            var          innerException = new Exception(innerMessage);
            var          exception      = new UnknownArgumentException(argument, message, innerException);

            using (var memoryStream = new MemoryStream())
            {
                // Serialize exception.
                var formatter = new BinaryFormatter();
                formatter.Serialize(memoryStream, exception);

                memoryStream.Position = 0;

                // Deserialize exception.
                formatter = new BinaryFormatter();
                var deserializedException = (UnknownArgumentException)formatter.Deserialize(memoryStream);

                Assert.AreEqual(argument, deserializedException.Argument);
                Assert.AreEqual(message, deserializedException.Message);
                Assert.AreEqual(innerMessage, deserializedException.InnerException.Message);
            }
        }
Exemple #3
0
        public void ConstructorTest1()
        {
            const string argument  = "Argument";
            var          exception = new UnknownArgumentException(argument);

            Assert.AreEqual(argument, exception.Argument);
        }
Exemple #4
0
 public void ConstructorTest3()
 {
     const string message = "message";
     var innerException = new Exception();
     var exception = new UnknownArgumentException(message, innerException);
     Assert.AreEqual(message, exception.Message);
     Assert.AreEqual(innerException, exception.InnerException);
 }
Exemple #5
0
 public void ConstructorTest2()
 {
     const string argument = "Argument";
     const string message = "message";
     var exception = new UnknownArgumentException(argument, message);
     Assert.AreEqual(argument, exception.Argument);
     Assert.AreEqual(message, exception.Message);
 }
Exemple #6
0
        public void ConstructorTest3()
        {
            const string message        = "message";
            var          innerException = new Exception();
            var          exception      = new UnknownArgumentException(message, innerException);

            Assert.AreEqual(message, exception.Message);
            Assert.AreEqual(innerException, exception.InnerException);
        }
Exemple #7
0
        public void ConstructorTest2()
        {
            const string argument  = "Argument";
            const string message   = "message";
            var          exception = new UnknownArgumentException(argument, message);

            Assert.AreEqual(argument, exception.Argument);
            Assert.AreEqual(message, exception.Message);
        }
Exemple #8
0
 public void ConstructorTest1()
 {
     const string argument = "Argument";
     var exception = new UnknownArgumentException(argument);
     Assert.AreEqual(argument, exception.Argument);
 }
Exemple #9
0
 public void ConstructorTest0()
 {
     var exception = new UnknownArgumentException();
 }
Exemple #10
0
 public void ConstructorTest0()
 {
     var exception = new UnknownArgumentException();
 }