public void WHEN_CallingNonpublicMethod_THEN_MethodIsNotExecuted() { var args = new[] { "nonpublicmethod" }; CmdLine <TestClassStatic> .Execute(args).Should().Be(-1); TestClassStatic.GetMethodInvokedAndReset().Should().BeNull(); }
public void WHEN_ClassHasStaticMethod_THEN_MethodIsExecuted() { var args = new[] { "test1", "/arg=str" }; CmdLine <TestClassStatic> .Execute(args).Should().Be(0); TestClassStatic.GetMethodInvokedAndReset().Should().Be("test1"); }
public void WHEN_MethodHasNullableArgWithDefault_AND_ArgIsNotProvided_THEN_MethodIsExecuted() { var args = new[] { "nullablewithdefault" }; CmdLine <TestClassStatic> .Execute(args).Should().Be(0); TestClassStatic.GetMethodInvokedAndReset().Should().Be("nullablewithdefault"); }
public void WHEN_MethodHasNullableArg_AND_ArgIsProvided_THEN_MethodIsExecuted() { var args = new[] { "nullable", "/value=3" }; CmdLine <TestClassStatic> .Execute(args).Should().Be(0); TestClassStatic.GetMethodInvokedAndReset().Should().Be("nullable"); }
public void WHEN_MethodHasNullableArg_AND_ArgIsNotProvided_THEN_MethodIsNotExecuted() { var args = new[] { "nullable" }; CmdLine <TestClassStatic> .Execute(args).Should().Be(-1); TestClassStatic.GetMethodInvokedAndReset().Should().BeNull(); }
public void WHEN_UsingCustomArgSeparator_AND_ArgIsInvalid_THEN_MethodIsNotExecuted() // AND_ErrorMessageIsDisplayed { var config = new CmdLineConfig { ArgSeparator = ':' }; var args = new[] { "test3", "/count=2", "/list=1,2" }; CmdLine <TestClassStatic> .Execute(args, config); TestClassStatic.GetMethodInvokedAndReset().Should().BeNull(); }
public void WHEN_ArgLetterCasingIsDifferent_THEN_MethodIsExecuted() { var args = new[] { "test3", "/Count=1", "/lIst=1" }; CmdLine <TestClassStatic> .Execute(args).Should().Be(0); TestClassStatic.GetMethodInvokedAndReset().Should().Be("test3"); args = new[] { "TEST3", "/COUNT=2", "/list=1,2" }; CmdLine <TestClassStatic> .Execute(args).Should().Be(0); TestClassStatic.GetMethodInvokedAndReset().Should().Be("test3"); }
public void WHEN_ArgIsValueTypeArray_THEN_MethodIsExecuted() { var args = new[] { "test3", "/count=1", "/list=1" }; CmdLine <TestClassStatic> .Execute(args).Should().Be(0); TestClassStatic.GetMethodInvokedAndReset().Should().Be("test3"); args = new[] { "test3", "/count=2", "/list=1,2" }; CmdLine <TestClassStatic> .Execute(args).Should().Be(0); TestClassStatic.GetMethodInvokedAndReset().Should().Be("test3"); }
public void WHEN_UsingCustomArgSeparator_THEN_MethodIsExecuted() { var config = new CmdLineConfig { ArgSeparator = ':' }; var args = new[] { "test3", "/count:1", "/list:1" }; CmdLine <TestClassStatic> .Execute(args, config).Should().Be(0); TestClassStatic.GetMethodInvokedAndReset().Should().Be("test3"); args = new[] { "test3", "/count:2", "/list:1,2" }; CmdLine <TestClassStatic> .Execute(args, config).Should().Be(0); TestClassStatic.GetMethodInvokedAndReset().Should().Be("test3"); }
public void InitializeTest() { TestClassStatic.Reset(); }