public void SerializationTest()
        {
            const string argument       = "arg01";
            const string message        = "message";
            const string innerMessage   = "Inner exception";
            var          innerException = new Exception(innerMessage);
            var          exception      = new CommandLineParserException(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 = (CommandLineParserException)formatter.Deserialize(memoryStream);

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

            Assert.AreEqual(message, exception.Message);
        }
Beispiel #3
0
 public void ConstructorTest4()
 {
     const string message = "message";
     var innerException = new Exception();
     var exception = new CommandLineParserException(message, innerException);
     Assert.AreEqual(message, exception.Message);
     Assert.AreEqual(innerException, exception.InnerException);
 }
Beispiel #4
0
 public void ConstructorTest3()
 {
     var argument = new ValueArgument<string>("arg", "");
     const string message = "message";
     var exception = new CommandLineParserException(argument, message);
     Assert.AreEqual(argument.Name, exception.Argument);
     Assert.AreEqual(message, exception.Message);
 }
Beispiel #5
0
 public void ConstructorTest2()
 {
     const string argument = "arg";
     const string message = "message";
     var exception = new CommandLineParserException(argument, message);
     Assert.AreEqual(argument, exception.Argument);
     Assert.AreEqual(message, exception.Message);
 }
        public void ConstructorTest3()
        {
            var          argument  = new ValueArgument <string>("arg", "");
            const string message   = "message";
            var          exception = new CommandLineParserException(argument, message);

            Assert.AreEqual(argument.Name, exception.Argument);
            Assert.AreEqual(message, exception.Message);
        }
        public void ConstructorTest2()
        {
            const string argument  = "arg";
            const string message   = "message";
            var          exception = new CommandLineParserException(argument, message);

            Assert.AreEqual(argument, exception.Argument);
            Assert.AreEqual(message, exception.Message);
        }
 public void ConstructorTest0()
 {
     var exception = new CommandLineParserException();
 }
Beispiel #9
0
        public void SerializationTest()
        {
            const string argument = "arg01";
            const string message = "message";
            const string innerMessage = "Inner exception";
            var innerException = new Exception(innerMessage);
            var exception = new CommandLineParserException(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 = (CommandLineParserException)formatter.Deserialize(memoryStream);

                Assert.AreEqual(argument, deserializedException.Argument);
                Assert.AreEqual(message, deserializedException.Message);
                Assert.AreEqual(innerMessage, deserializedException.InnerException.Message);
            }
        }
Beispiel #10
0
 public void ConstructorTest0()
 {
     var exception = new CommandLineParserException();
 }