public void DuplicateArgsShouldThrow() { migrate::CmdLine.CommandLine.CommandEnvironment = new TestCommandEnvironment("/N:123 /N:345"); var commandArg = new migrate::CmdLine.CommandArgument("/N:345", 7); commandArg.Command = "N"; Assert.Equal( new migrate::CmdLine.CommandLineArgumentInvalidException(typeof(string), commandArg).Message, Assert.Throws <migrate::CmdLine.CommandLineArgumentInvalidException>(() => migrate::CmdLine.CommandLine.Parse <TestArgs>()). Message); }
public void NoMatchingPropertyWithInferredShouldThrow() { var args = new[] { "/NoMatch" }; migrate::CmdLine.CommandLine.CommandEnvironment = new TestCommandEnvironment(args); var commandArg = new migrate::CmdLine.CommandArgument("/NoMatch", 0); commandArg.Command = "NoMatch"; Assert.Equal( new migrate::CmdLine.CommandLineArgumentInvalidException(typeof(string), commandArg).Message, Assert.Throws <migrate::CmdLine.CommandLineArgumentInvalidException>( () => migrate::CmdLine.CommandLine.Parse <InferredTestArgs>()).Message); }
[Fact] // CodePlex 1107 public void Deserialized_exception_can_be_serialized_and_deserialized_again() { var commandArg = new migrate::CmdLine.CommandArgument("/N:345", 7); commandArg.Command = "N"; var ex = new migrate::CmdLine.CommandLineArgumentInvalidException( typeof(CommandLineExceptionTests.SomeCommandLineClass), commandArg); Assert.Contains("/N:345", ex.Message); Assert.Contains( "/N:345", ExceptionHelpers.SerializeAndDeserialize(ExceptionHelpers.SerializeAndDeserialize(ex)).Message); }
[Fact] // CodePlex 1107 public void Deserialized_exception_can_be_serialized_and_deserialized_again() { var commandArg = new migrate::CmdLine.CommandArgument("/N:345", 7); commandArg.Command = "N"; var ex = new migrate::CmdLine.CommandLineRequiredArgumentMissingException( typeof(CommandLineExceptionTests.SomeCommandLineClass), "/N:345", 7); Assert.Contains("/N:345", ex.Message); Assert.Contains( "/N:345", ExceptionHelpers.SerializeAndDeserialize(ExceptionHelpers.SerializeAndDeserialize(ex)).Message); }
public void NoMatchingPropertyWithInferredShouldThrow() { var args = new[] { "/NoMatch" }; migrate::CmdLine.CommandLine.CommandEnvironment = new TestCommandEnvironment(args); var commandArg = new migrate::CmdLine.CommandArgument("/NoMatch", 0); commandArg.Command = "NoMatch"; Assert.Equal( new migrate::CmdLine.CommandLineArgumentInvalidException(typeof(string), commandArg).Message, Assert.Throws<migrate::CmdLine.CommandLineArgumentInvalidException>( () => migrate::CmdLine.CommandLine.Parse<InferredTestArgs>()).Message); }
public void DuplicateArgsShouldThrow() { migrate::CmdLine.CommandLine.CommandEnvironment = new TestCommandEnvironment("/N:123 /N:345"); var commandArg = new migrate::CmdLine.CommandArgument("/N:345", 7); commandArg.Command = "N"; Assert.Equal( new migrate::CmdLine.CommandLineArgumentInvalidException(typeof(string), commandArg).Message, Assert.Throws<migrate::CmdLine.CommandLineArgumentInvalidException>(() => migrate::CmdLine.CommandLine.Parse<TestArgs>()). Message); }