//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldPrintUsageForACommand() internal virtual void ShouldPrintUsageForACommand() { // given AdminCommand_Provider commandProvider = MockCommand("bam", "A summary", AdminCommandSection.General()); AdminCommand_Provider[] commands = new AdminCommand_Provider[] { commandProvider }; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final Usage usage = new Usage("neo4j-admin", new CannedLocator(commands)); Usage usage = new Usage("neo4j-admin", new CannedLocator(commands)); // when usage.PrintUsageForCommand(commandProvider, @out); // then InOrder ordered = inOrder(@out); ordered.verify(@out).accept("usage: neo4j-admin bam "); ordered.verify(@out).accept(""); ordered.verify(@out).accept("environment variables:"); ordered.verify(@out).accept(" NEO4J_CONF Path to directory which contains neo4j.conf."); ordered.verify(@out).accept(" NEO4J_DEBUG Set to anything to enable debug output."); ordered.verify(@out).accept(" NEO4J_HOME Neo4j home directory."); ordered.verify(@out).accept(" HEAP_SIZE Set JVM maximum heap size during command execution."); ordered.verify(@out).accept(" Takes a number and a unit, for example 512m."); ordered.verify(@out).accept(""); ordered.verify(@out).accept("description"); }
private static AdminCommand_Provider MockCommand(string name) { AdminCommand_Provider commandProvider = mock(typeof(AdminCommand_Provider)); when(commandProvider.Name()).thenReturn(name); when(commandProvider.CommandSection()).thenReturn(AdminCommandSection.General()); return(commandProvider); }
private void PrintCommands(System.Action <string> output) { IDictionary <AdminCommandSection, IList <AdminCommand_Provider> > groupedProviders = GroupProvidersBySection(); AdminCommandSection.General().printAllCommandsUnderSection(output, groupedProviders.Remove(AdminCommandSection.General())); groupedProviders.SetOfKeyValuePairs().OrderBy(System.Collections.IComparer.comparing(groupedProvider => groupedProvider.Key.printable())).ForEach(entry => entry.Key.printAllCommandsUnderSection(output, entry.Value)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void hashCodeUsingReflection() internal virtual void HashCodeUsingReflection() { TestGeneralSection testGeneralSection = new TestGeneralSection(); TestAnotherGeneralSection testAnotherGeneralSection = new TestAnotherGeneralSection(); Dictionary <AdminCommandSection, string> map = new Dictionary <AdminCommandSection, string>(); map[AdminCommandSection.General()] = "General-Original"; map[testGeneralSection] = "General-Test"; map[testAnotherGeneralSection] = "General-AnotherTest"; assertEquals(2, map.Count); assertEquals("General-Test", map[AdminCommandSection.General()]); assertEquals("General-Test", map[testGeneralSection]); assertEquals("General-AnotherTest", map[testAnotherGeneralSection]); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldPrintUsageForAllCommandsAlphabetically() internal virtual void ShouldPrintUsageForAllCommandsAlphabetically() { AdminCommandSection generalSection = AdminCommandSection.General(); IList <AdminCommand_Provider> providers = new IList <AdminCommand_Provider> { MockCommand("restore", "Restore"), MockCommand("bam", "A summary"), MockCommand("zzzz-last-one", "Another summary") }; generalSection.PrintAllCommandsUnderSection(@out, providers); InOrder ordered = inOrder(@out); ordered.verify(@out).accept(""); ordered.verify(@out).accept("General"); ordered.verify(@out).accept(" bam"); ordered.verify(@out).accept(" A summary"); ordered.verify(@out).accept(" restore"); ordered.verify(@out).accept(" Restore"); ordered.verify(@out).accept(" zzzz-last-one"); ordered.verify(@out).accept(" Another summary"); ordered.verifyNoMoreInteractions(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldPrintUsageWithConfiguration() internal virtual void ShouldPrintUsageWithConfiguration() { AdminCommand_Provider[] commands = new AdminCommand_Provider[] { MockCommand("bam", "A summary", AdminCommandSection.General()) }; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final Usage usage = new Usage("neo4j-admin", new CannedLocator(commands)); Usage usage = new Usage("neo4j-admin", new CannedLocator(commands)); usage.Print(@out); InOrder ordered = inOrder(@out); ordered.verify(@out).accept("usage: neo4j-admin <command>"); ordered.verify(@out).accept(""); ordered.verify(@out).accept("Manage your Neo4j instance."); ordered.verify(@out).accept(""); ordered.verify(@out).accept("environment variables:"); ordered.verify(@out).accept(" NEO4J_CONF Path to directory which contains neo4j.conf."); ordered.verify(@out).accept(" NEO4J_DEBUG Set to anything to enable debug output."); ordered.verify(@out).accept(" NEO4J_HOME Neo4j home directory."); ordered.verify(@out).accept(" HEAP_SIZE Set JVM maximum heap size during command execution."); ordered.verify(@out).accept(" Takes a number and a unit, for example 512m."); ordered.verify(@out).accept(""); ordered.verify(@out).accept("available commands:"); ordered.verify(@out).accept("General"); ordered.verify(@out).accept(" bam"); ordered.verify(@out).accept(" A summary"); ordered.verify(@out).accept(""); ordered.verify(@out).accept("Use neo4j-admin help <command> for more details."); ordered.verifyNoMoreInteractions(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Override @Nonnull public AdminCommandSection commandSection() public override AdminCommandSection CommandSection() { return(AdminCommandSection.General()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void equalsUsingReflection() internal virtual void EqualsUsingReflection() { assertEquals(AdminCommandSection.General(), new TestGeneralSection()); assertNotEquals(AdminCommandSection.General(), new TestAnotherGeneralSection()); }