//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldComputeDegreeWithoutType() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldComputeDegreeWithoutType()
        {
            // GIVEN
            long node;

            using (Transaction tx = Transaction())
            {
                Write write = tx.DataWrite();
                node = write.NodeCreate();
                write.RelationshipCreate(node, tx.TokenWrite().relationshipTypeGetOrCreateForName("R1"), write.NodeCreate());
                write.RelationshipCreate(node, tx.TokenWrite().relationshipTypeGetOrCreateForName("R2"), write.NodeCreate());
                write.RelationshipCreate(write.NodeCreate(), tx.TokenWrite().relationshipTypeGetOrCreateForName("R3"), node);
                write.RelationshipCreate(node, tx.TokenWrite().relationshipTypeGetOrCreateForName("R4"), node);

                tx.Success();
            }

            using (Transaction tx = Transaction())
            {
                Read          read    = tx.DataRead();
                CursorFactory cursors = tx.Cursors();
                using (NodeCursor nodes = cursors.AllocateNodeCursor())
                {
                    assertThat(CompiledExpandUtils.NodeGetDegreeIfDense(read, node, nodes, cursors, OUTGOING), equalTo(3));
                    assertThat(CompiledExpandUtils.NodeGetDegreeIfDense(read, node, nodes, cursors, INCOMING), equalTo(2));
                    assertThat(CompiledExpandUtils.NodeGetDegreeIfDense(read, node, nodes, cursors, BOTH), equalTo(4));
                }
            }
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldComputeDegreeWithType() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldComputeDegreeWithType()
        {
            // GIVEN
            long node;
            int  @in, @out, loop;

            using (Transaction tx = Transaction())
            {
                Write write = tx.DataWrite();
                node = write.NodeCreate();
                TokenWrite tokenWrite = tx.TokenWrite();
                @out = tokenWrite.RelationshipTypeGetOrCreateForName("OUT");
                @in  = tokenWrite.RelationshipTypeGetOrCreateForName("IN");
                loop = tokenWrite.RelationshipTypeGetOrCreateForName("LOOP");
                write.RelationshipCreate(node, @out, write.NodeCreate());
                write.RelationshipCreate(node, @out, write.NodeCreate());
                write.RelationshipCreate(write.NodeCreate(), @in, node);
                write.RelationshipCreate(node, loop, node);

                tx.Success();
            }

            using (Transaction tx = Transaction())
            {
                Read          read    = tx.DataRead();
                CursorFactory cursors = tx.Cursors();
                using (NodeCursor nodes = cursors.AllocateNodeCursor())
                {
                    assertThat(nodeGetDegreeIfDense(read, node, nodes, cursors, OUTGOING, @out), equalTo(2));
                    assertThat(nodeGetDegreeIfDense(read, node, nodes, cursors, OUTGOING, @in), equalTo(0));
                    assertThat(nodeGetDegreeIfDense(read, node, nodes, cursors, OUTGOING, loop), equalTo(1));

                    assertThat(nodeGetDegreeIfDense(read, node, nodes, cursors, INCOMING, @out), equalTo(0));
                    assertThat(nodeGetDegreeIfDense(read, node, nodes, cursors, INCOMING, @in), equalTo(1));
                    assertThat(nodeGetDegreeIfDense(read, node, nodes, cursors, INCOMING, loop), equalTo(1));

                    assertThat(nodeGetDegreeIfDense(read, node, nodes, cursors, BOTH, @out), equalTo(2));
                    assertThat(nodeGetDegreeIfDense(read, node, nodes, cursors, BOTH, @in), equalTo(1));
                    assertThat(nodeGetDegreeIfDense(read, node, nodes, cursors, BOTH, loop), equalTo(1));
                }
            }
        }