public void BitsMarkedInSequenceWhenMultipleTokensSet()
        {
            BinarySequenceHashBuilder hash = new BinarySequenceHashBuilder();

            hash.AppendOneSequence();
            hash.AppendZeroToSequence();
            hash.AppendOneSequence();
            hash.AppendZeroToSequence();

            byte[] bytes = hash.GetBytes();

            Assert.AreEqual(10 /* think binary flags */, bytes[0]);
        }
        public void BitIs0WhenTokenIsAlpha()
        {
            BinarySequenceHashBuilder hash = new BinarySequenceHashBuilder();

            hash.AppendZeroToSequence();

            Assert.AreEqual(0, hash.GetBytes()[0]);
        }
        public void HashesAreEqualWhenEquivalentHashesAreCompared()
        {
            BinarySequenceHashBuilder hash1 = new BinarySequenceHashBuilder();

            for (int i = 0; i < Byte.MaxValue; i++)
            {
                if (i % 3 == 0)
                {
                    hash1.AppendOneSequence();
                }
                else if (i % 2 == 0)
                {
                    hash1.AppendZeroToSequence();
                }
            }

            BinarySequenceHashBuilder hash2 = new BinarySequenceHashBuilder(hash1.GetBytes());

            Assert.IsTrue(hash1 == hash2, "==");
            Assert.IsTrue(hash1.Equals(hash2), ".Equals");
        }
        public void HashInCorrectStringFormatWhenToStringInvoked()
        {
            BinarySequenceHashBuilder hash = new BinarySequenceHashBuilder();

            hash.AppendOneSequence();
            hash.AppendZeroToSequence();
            hash.AppendOneSequence();
            hash.AppendZeroToSequence();

            hash.AppendOneSequence();
            hash.AppendZeroToSequence();
            hash.AppendOneSequence();
            hash.AppendZeroToSequence();

            Assert.AreEqual("AA0000000000000000000000000000000000000000000000000000000000000008",
                            hash.ToString());
        }
        public void TokenCountIncreasedWhenTokenMarked()
        {
            BinarySequenceHashBuilder hash = new BinarySequenceHashBuilder();

            Assert.AreEqual(0, hash.SequenceLength);

            hash.AppendZeroToSequence();
            Assert.AreEqual(1, hash.SequenceLength);

            hash.AppendOneSequence();
            Assert.AreEqual(2, hash.SequenceLength);
        }
        public void MarkNumberWhenMaxNumberOfMarkersReached()
        {
            byte[] sequence = new byte[BinarySequenceHashBuilder.SEQUENCE_BYTE_LENGTH];
            sequence[BinarySequenceHashBuilder.SEQUENCE_BYTE_LENGTH - 1] = Byte.MaxValue;

            BinarySequenceHashBuilder hash = new BinarySequenceHashBuilder(sequence);

            hash.AppendZeroToSequence();
        }