//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")); } }
//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")); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void defaultsToCsvWhenModeNotSpecified() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void DefaultsToCsvWhenModeNotSpecified() { File homeDir = _testDir.directory("home"); ImporterFactory mockImporterFactory = mock(typeof(ImporterFactory)); Importer importer = mock(typeof(Importer)); when(mockImporterFactory.GetImporterForMode(eq("csv"), any(typeof(Args)), any(typeof(Config)), any(typeof(OutsideWorld)))).thenReturn(importer); using (RealOutsideWorld outsideWorld = new RealOutsideWorld(System.out, System.err, new MemoryStream(new sbyte[0]))) { ImportCommand importCommand = new ImportCommand(homeDir.toPath(), _testDir.directory("conf").toPath(), outsideWorld, mockImporterFactory); string[] arguments = new string[] { "--database=foo", "--from=bar" }; importCommand.Execute(arguments); verify(mockImporterFactory).getImporterForMode(eq("csv"), any(typeof(Args)), any(typeof(Config)), any(typeof(OutsideWorld))); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void letImporterDecideAboutDatabaseExistence() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void LetImporterDecideAboutDatabaseExistence() { File report = _testDir.file("report"); Path homeDir = _testDir.directory("home").toPath(); PrintStream nullOutput = new PrintStream(NULL_OUTPUT_STREAM); OutsideWorld outsideWorld = new RealOutsideWorld(nullOutput, nullOutput, new MemoryStream(new sbyte[0])); Path confPath = _testDir.directory("conf").toPath(); ImportCommand importCommand = new ImportCommand(homeDir, confPath, outsideWorld); File nodesFile = CreateTextFile("nodes.csv", ":ID", "1", "2"); string[] arguments = new string[] { "--mode=csv", "--database=existing.db", "--nodes=" + nodesFile.AbsolutePath, "--report-file=" + report.AbsolutePath }; // First run an import so that a database gets created importCommand.Execute(arguments); // When ImporterFactory importerFactory = mock(typeof(ImporterFactory)); Importer importer = mock(typeof(Importer)); when(importerFactory.GetImporterForMode(any(), any(), any(), any())).thenReturn(importer); (new ImportCommand(homeDir, confPath, outsideWorld, importerFactory)).Execute(arguments); // Then no exception about database existence should be thrown }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Override @Nonnull public java.util.List<org.neo4j.commandline.arguments.Arguments> possibleArguments() public override IList <Arguments> PossibleArguments() { return(Arrays.asList(ImportCommand.CsvArguments(), ImportCommand.DatabaseArguments())); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Override @Nonnull public org.neo4j.commandline.arguments.Arguments allArguments() public override Arguments AllArguments() { return(ImportCommand.AllArguments()); }