コード例 #1
0
        public void Constructor_uses_given_message_and_sets_up_serialization()
        {
            var exception = new migrate::CmdLine.CommandLineException("I'm a DOS prompt.");

            Assert.Equal("I'm a DOS prompt.", exception.Message);
            Assert.Null(exception.ArgumentHelp);

            exception = ExceptionHelpers.SerializeAndDeserialize(exception);

            Assert.Equal("I'm a DOS prompt.", exception.Message);
            Assert.Null(exception.ArgumentHelp);
        }
コード例 #2
0
        public void Constructor_uses_given_message_and_sets_up_serialization()
        {
            var exception = new migrate::CmdLine.CommandLineException("I'm a DOS prompt.");

            Assert.Equal("I'm a DOS prompt.", exception.Message);
            Assert.Null(exception.ArgumentHelp);

            exception = ExceptionHelpers.SerializeAndDeserialize(exception);

            Assert.Equal("I'm a DOS prompt.", exception.Message);
            Assert.Null(exception.ArgumentHelp);
        }
コード例 #3
0
        [Fact] // CodePlex 1107
        public void Deserialized_exception_can_be_serialized_and_deserialized_again()
        {
            var innerException = new Exception("You are so exceptional!");
            var exception      =
                new migrate::CmdLine.CommandLineException(
                    new migrate::CmdLine.CommandArgumentHelp(typeof(SomeCommandLineClass), "Look inside."), innerException);

            exception = ExceptionHelpers.SerializeAndDeserialize(ExceptionHelpers.SerializeAndDeserialize(exception));

            Assert.Equal("Look inside.", exception.Message);
            Assert.Equal(innerException.Message, exception.InnerException.Message);
            Assert.Equal("Code First Migrations Command Line Utility", exception.ArgumentHelp.Title);
        }
コード例 #4
0
        public void Constructor_uses_given_ArgumentHelp_and_sets_up_serialization()
        {
            var exception =
                new migrate::CmdLine.CommandLineException(
                    new migrate::CmdLine.CommandArgumentHelp(typeof(SomeCommandLineClass), "CLI"));

            Assert.Equal("CLI", exception.Message);
            Assert.Equal("Code First Migrations Command Line Utility", exception.ArgumentHelp.Title);

            exception = ExceptionHelpers.SerializeAndDeserialize(exception);

            Assert.Equal("CLI", exception.Message);
            Assert.Equal("Code First Migrations Command Line Utility", exception.ArgumentHelp.Title);
        }
コード例 #5
0
        public void Constructor_uses_given_ArgumentHelp_and_sets_up_serialization()
        {
            var exception =
                new migrate::CmdLine.CommandLineException(
                    new migrate::CmdLine.CommandArgumentHelp(typeof(SomeCommandLineClass), "CLI"));

            Assert.Equal("CLI", exception.Message);
            Assert.Equal("Code First Migrations Command Line Utility", exception.ArgumentHelp.Title);

            exception = ExceptionHelpers.SerializeAndDeserialize(exception);

            Assert.Equal("CLI", exception.Message);
            Assert.Equal("Code First Migrations Command Line Utility", exception.ArgumentHelp.Title);
        }
コード例 #6
0
        public void Constructor_uses_given_ArgumentHelp_and_inner_exception_and_sets_up_serialization()
        {
            var innerException = new Exception("You are so exceptional!");
            var exception =
                new migrate::CmdLine.CommandLineException(
                    new migrate::CmdLine.CommandArgumentHelp(typeof(SomeCommandLineClass), "Look inside."), innerException);

            Assert.Equal("Look inside.", exception.Message);
            Assert.Same(innerException, exception.InnerException);
            Assert.Equal("Code First Migrations Command Line Utility", exception.ArgumentHelp.Title);

            exception = ExceptionHelpers.SerializeAndDeserialize(exception);

            Assert.Equal("Look inside.", exception.Message);
            Assert.Equal(innerException.Message, exception.InnerException.Message);
            Assert.Equal("Code First Migrations Command Line Utility", exception.ArgumentHelp.Title);
        }
コード例 #7
0
        public void Constructor_uses_given_ArgumentHelp_and_inner_exception_and_sets_up_serialization()
        {
            var innerException = new Exception("You are so exceptional!");
            var exception      =
                new migrate::CmdLine.CommandLineException(
                    new migrate::CmdLine.CommandArgumentHelp(typeof(SomeCommandLineClass), "Look inside."), innerException);

            Assert.Equal("Look inside.", exception.Message);
            Assert.Same(innerException, exception.InnerException);
            Assert.Equal("Code First Migrations Command Line Utility", exception.ArgumentHelp.Title);

            exception = ExceptionHelpers.SerializeAndDeserialize(exception);

            Assert.Equal("Look inside.", exception.Message);
            Assert.Equal(innerException.Message, exception.InnerException.Message);
            Assert.Equal("Code First Migrations Command Line Utility", exception.ArgumentHelp.Title);
        }
コード例 #8
0
        [Fact] // CodePlex 1107
        public void Deserialized_exception_can_be_serialized_and_deserialized_again()
        {
            var innerException = new Exception("You are so exceptional!");
            var exception =
                new migrate::CmdLine.CommandLineException(
                    new migrate::CmdLine.CommandArgumentHelp(typeof(SomeCommandLineClass), "Look inside."), innerException);

            exception = ExceptionHelpers.SerializeAndDeserialize(ExceptionHelpers.SerializeAndDeserialize(exception));

            Assert.Equal("Look inside.", exception.Message);
            Assert.Equal(innerException.Message, exception.InnerException.Message);
            Assert.Equal("Code First Migrations Command Line Utility", exception.ArgumentHelp.Title);
        }