示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldRuleWorkWithExistingDirectory() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldRuleWorkWithExistingDirectory()
        {
            // given a root folder, create /databases/graph.db folders.
            File oldDir             = TestDirectory.directory("old");
            File storeDir           = Config.defaults(GraphDatabaseSettings.data_directory, oldDir.toPath().ToString()).get(GraphDatabaseSettings.database_path);
            GraphDatabaseService db = (new TestGraphDatabaseFactory()).newEmbeddedDatabase(storeDir);

            try
            {
                Db.execute("CREATE ()");
            }
            finally
            {
                Db.shutdown();
            }

            // When a rule with an pre-populated graph db directory is used
            File newDir = TestDirectory.directory("new");
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.harness.junit.Neo4jRule ruleWithDirectory = new org.neo4j.harness.junit.Neo4jRule(newDir).copyFrom(oldDir);
            Neo4jRule ruleWithDirectory = (new Neo4jRule(newDir)).copyFrom(oldDir);
            Statement statement         = ruleWithDirectory.apply(new StatementAnonymousInnerClass(this, ruleWithDirectory)
                                                                  , null);

            // Then
            statement.evaluate();
        }