//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldThrowOnIndexExistsWithMismatchingConfiguration()
        public virtual void ShouldThrowOnIndexExistsWithMismatchingConfiguration()
        {
            // given
            ExplicitIndexTransactionStateImpl state = NewExplicitIndexTxState();

            when(_provider.configMatches(anyMap(), anyMap())).thenReturn(false);

            // when
            try
            {
                state.CheckIndexExistence(IndexEntityType.Node, "name", _config);
                fail("Should've failed");
            }
            catch (System.ArgumentException)
            {               // then good
            }
            try
            {
                state.CheckIndexExistence(IndexEntityType.Node, "name", _config);
                fail("Should have failed");
            }
            catch (System.ArgumentException)
            {               // then good
            }
        }
        private static ISet <StorageCommand> ExtractCommands(ExplicitIndexTransactionStateImpl state)
        {
            ISet <StorageCommand> commands = new HashSet <StorageCommand>();

            state.ExtractCommands(commands);
            return(commands);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReportIndexDoesNotExist()
        public virtual void ShouldReportIndexDoesNotExist()
        {
            // given
            ExplicitIndexTransactionStateImpl state = NewExplicitIndexTxState();

            when(_indexConfigStore.get(any(typeof(Type)), anyString())).thenReturn(null);

            // when
            bool exists = state.CheckIndexExistence(IndexEntityType.Relationship, "name", null);

            // then
            assertFalse(exists);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReportIndexExists()
        public virtual void ShouldReportIndexExists()
        {
            // given
            ExplicitIndexTransactionStateImpl state = NewExplicitIndexTxState();

            // when
            bool nodeExists = state.CheckIndexExistence(IndexEntityType.Node, "name", null);
            bool relExists  = state.CheckIndexExistence(IndexEntityType.Relationship, "name", null);

            // then
            assertTrue(nodeExists);
            assertTrue(relExists);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReportIndexExistsWithMatchingConfiguration()
        public virtual void ShouldReportIndexExistsWithMatchingConfiguration()
        {
            // given
            ExplicitIndexTransactionStateImpl state = NewExplicitIndexTxState();

            when(_provider.configMatches(anyMap(), anyMap())).thenReturn(true);

            // when
            bool nodeExists = state.CheckIndexExistence(IndexEntityType.Node, "name", _config);
            bool relExists  = state.CheckIndexExistence(IndexEntityType.Node, "name", _config);

            // then
            assertTrue(nodeExists);
            assertTrue(relExists);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void removalOfRelationshipIndexDoesNotClearNodeCommandsForNodeIndexWithSameName()
        public virtual void RemovalOfRelationshipIndexDoesNotClearNodeCommandsForNodeIndexWithSameName()
        {
            ExplicitIndexTransactionStateImpl state = NewExplicitIndexTxState();

            state.AddNode("index", 1, "key", "value");
            state.AddRelationship("index", 1, "key", "value", 11, 11);
            state.DeleteIndex(IndexEntityType.Relationship, "index");

            IndexDefineCommand indexDefinedCommand = new IndexDefineCommand();

            indexDefinedCommand.GetOrAssignIndexNameId("index");
            indexDefinedCommand.GetOrAssignKeyId("key");

            IndexCommand.DeleteCommand delete = new IndexCommand.DeleteCommand();
            delete.Init(1, IndexEntityType.Relationship.id());

            ISet <Command> expectedCommands = new HashSet <Command>(Arrays.asList(indexDefinedCommand, delete, AddNode(1, 1, 1, "value")));

            assertEquals(expectedCommands, ExtractCommands(state));
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void tracksRelationshipCommands()
        public virtual void TracksRelationshipCommands()
        {
            ExplicitIndexTransactionStateImpl state = NewExplicitIndexTxState();

            state.RemoveRelationship("index1", 1, "key1", "value1");
            state.AddRelationship("index1", 1, "key2", "value2", 11, 11);
            state.RemoveRelationship("index1", 2, "key1", "value3");
            state.AddRelationship("index1", 3, "key2", "value4", 22, 22);
            state.AddRelationship("index2", 4, "key1", "value5", 33, 33);

            IndexDefineCommand indexDefinedCommand = new IndexDefineCommand();

            indexDefinedCommand.GetOrAssignIndexNameId("index1");
            indexDefinedCommand.GetOrAssignIndexNameId("index2");
            indexDefinedCommand.GetOrAssignKeyId("key1");
            indexDefinedCommand.GetOrAssignKeyId("key2");

            ISet <Command> expectedCommands = new HashSet <Command>(Arrays.asList(indexDefinedCommand, RemoveRelationship(1, 1, 1, "value1"), AddRelationship(1, 1, 2, "value2", 11, 11), RemoveRelationship(1, 2, 1, "value3"), AddRelationship(1, 3, 2, "value4", 22, 22), AddRelationship(2, 4, 1, "value5", 33, 33)));

            assertEquals(expectedCommands, ExtractCommands(state));
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void relationshipIndexDeletionRemovesCommands()
        public virtual void RelationshipIndexDeletionRemovesCommands()
        {
            ExplicitIndexTransactionStateImpl state = NewExplicitIndexTxState();

            state.RemoveRelationship("index", 1, "key", "value1");
            state.AddRelationship("index", 2, "key", "value2", 11, 11);
            state.AddRelationship("index", 3, "key", "value3", 22, 22);

            state.DeleteIndex(IndexEntityType.Relationship, "index");

            IndexDefineCommand indexDefinedCommand = new IndexDefineCommand();

            indexDefinedCommand.GetOrAssignIndexNameId("index");
            indexDefinedCommand.GetOrAssignKeyId("key");

            IndexCommand.DeleteCommand delete = new IndexCommand.DeleteCommand();
            delete.Init(1, IndexEntityType.Relationship.id());

            ISet <Command> expectedCommands = new HashSet <Command>(Arrays.asList(indexDefinedCommand, delete));

            assertEquals(expectedCommands, ExtractCommands(state));
        }