//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testRegisterUnregisterHandlers() public virtual void TestRegisterUnregisterHandlers() { GraphDatabaseService graphDb = (new TestGraphDatabaseFactory()).newImpermanentDatabase(); KernelEventHandler handler1 = new DummyKernelEventHandlerAnonymousInnerClass(this, _resource1); KernelEventHandler handler2 = new DummyKernelEventHandlerAnonymousInnerClass2(this, _resource2); try { graphDb.UnregisterKernelEventHandler(handler1); fail("Shouldn't be able to do unregister on a " + "unregistered handler"); } catch (System.InvalidOperationException) { // Good } assertSame(handler1, graphDb.RegisterKernelEventHandler(handler1)); assertSame(handler1, graphDb.RegisterKernelEventHandler(handler1)); assertSame(handler1, graphDb.UnregisterKernelEventHandler(handler1)); try { graphDb.UnregisterKernelEventHandler(handler1); fail("Shouldn't be able to do unregister on a " + "unregistered handler"); } catch (System.InvalidOperationException) { // Good } assertSame(handler1, graphDb.RegisterKernelEventHandler(handler1)); assertSame(handler2, graphDb.RegisterKernelEventHandler(handler2)); assertSame(handler1, graphDb.UnregisterKernelEventHandler(handler1)); assertSame(handler2, graphDb.UnregisterKernelEventHandler(handler2)); graphDb.Shutdown(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testShutdownEvents() public virtual void TestShutdownEvents() { GraphDatabaseService graphDb = (new TestGraphDatabaseFactory()).newImpermanentDatabase(); DummyKernelEventHandler handler1 = new DummyKernelEventHandlerAnonymousInnerClass3(this, _resource1); DummyKernelEventHandler handler2 = new DummyKernelEventHandlerAnonymousInnerClass4(this, _resource1); graphDb.RegisterKernelEventHandler(handler1); graphDb.RegisterKernelEventHandler(handler2); graphDb.Shutdown(); assertEquals(Convert.ToInt32(0), handler2.BeforeShutdownConflict); assertEquals(Convert.ToInt32(1), handler1.BeforeShutdownConflict); }