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); }
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); }
[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); }
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); }
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); }
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); }
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); }
[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); }