예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void requiresDatabaseArgument()
        internal virtual void RequiresDatabaseArgument()
        {
            using (NullOutsideWorld outsideWorld = new NullOutsideWorld())
            {
                ImportCommand importCommand = new ImportCommand(_testDir.directory("home").toPath(), _testDir.directory("conf").toPath(), outsideWorld);

                string[]       arguments      = new string[] { "--mode=database", "--from=bar" };
                IncorrectUsage incorrectUsage = assertThrows(typeof(IncorrectUsage), () => importCommand.execute(arguments));
                assertThat(incorrectUsage.Message, containsString("database"));
            }
        }
예제 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void failIfInvalidModeSpecified()
        internal virtual void FailIfInvalidModeSpecified()
        {
            using (NullOutsideWorld outsideWorld = new NullOutsideWorld())
            {
                ImportCommand importCommand = new ImportCommand(_testDir.directory("home").toPath(), _testDir.directory("conf").toPath(), outsideWorld);

                string[]       arguments      = new string[] { "--mode=foo", "--database=bar", "--from=baz" };
                IncorrectUsage incorrectUsage = assertThrows(typeof(IncorrectUsage), () => importCommand.execute(arguments));
                assertThat(incorrectUsage.Message, containsString("foo"));
            }
        }
예제 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void databaseAndBackupAreMutuallyExclusive() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void DatabaseAndBackupAreMutuallyExclusive()
        {
            ConsistencyCheckService consistencyCheckService = mock(typeof(ConsistencyCheckService));

            Path homeDir = _testDir.directory("home").toPath();
            CheckConsistencyCommand checkConsistencyCommand = new CheckConsistencyCommand(homeDir, _testDir.directory("conf").toPath(), consistencyCheckService);

            when(consistencyCheckService.runFullConsistencyCheck(any(), any(), any(), any(), any(), anyBoolean(), any(typeof(ConsistencyFlags)))).thenReturn(ConsistencyCheckService.Result.success(null));

            IncorrectUsage incorrectUsage = assertThrows(typeof(IncorrectUsage), () => checkConsistencyCommand.execute(new string[] { "--database=foo", "--backup=bar" }));

            assertEquals("Only one of '--database' and '--backup' can be specified.", incorrectUsage.Message);
        }
예제 #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void throwsOnUnexpectedPositionalArgumentWhenExpectingSome()
        internal virtual void ThrowsOnUnexpectedPositionalArgumentWhenExpectingSome()
        {
            IncorrectUsage incorrectUsage = assertThrows(typeof(IncorrectUsage), () => _builder.withMandatoryPositionalArgument(0, "first").withOptionalPositionalArgument(1, "second").parse(new string[] { "one", "two", "three", "four" }));

            assertEquals("unrecognized arguments: 'three four'", incorrectUsage.Message);
        }
예제 #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void throwsOnUnexpectedPositionalArgument()
        internal virtual void ThrowsOnUnexpectedPositionalArgument()
        {
            IncorrectUsage incorrectUsage = assertThrows(typeof(IncorrectUsage), () => _builder.withDatabase().parse(new string[] { "bob", "sob" }));

            assertEquals("unrecognized arguments: 'bob sob'", incorrectUsage.Message);
        }
예제 #6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void throwsOnUnexpectedShortArgumentWithValue()
        internal virtual void ThrowsOnUnexpectedShortArgumentWithValue()
        {
            IncorrectUsage incorrectUsage = assertThrows(typeof(IncorrectUsage), () => _builder.withDatabase().parse(new string[] { "-f=bob" }));

            assertEquals("unrecognized option: 'f'", incorrectUsage.Message);
        }
예제 #7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void throwsOnUnexpectedLongArgumentWithValue()
        internal virtual void ThrowsOnUnexpectedLongArgumentWithValue()
        {
            IncorrectUsage incorrectUsage = assertThrows(typeof(IncorrectUsage), () => _builder.withDatabase().parse(new string[] { "--stacktrace=true" }));

            assertEquals("unrecognized option: 'stacktrace'", incorrectUsage.Message);
        }
예제 #8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void throwsOnTooFewPositionalArguments()
        internal virtual void ThrowsOnTooFewPositionalArguments()
        {
            IncorrectUsage incorrectUsage = assertThrows(typeof(IncorrectUsage), () => _builder.withMandatoryPositionalArgument(0, "first").withOptionalPositionalArgument(1, "second").parse(new string[] {}));

            assertEquals("not enough arguments", incorrectUsage.Message);
        }