Example #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"));
            }
        }
Example #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"));
            }
        }
Example #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);
        }
Example #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);
        }
Example #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);
        }
Example #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);
        }
Example #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);
        }
Example #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);
        }