Esempio n. 1
0
        public void BitArray1KEcsSignature_WhenEnableBit_SetsBit()
        {
            // Arrange
            var signature1 = new BitArray1KEcsSignature();
            var signature2 = new BitArray1KEcsSignature();
            var signature3 = new BitArray1KEcsSignature();

            // Act
            signature1.EnableBit(999);
            signature2.EnableBit(500);
            signature3.EnableBit(999);

            // Assert
            Assert.IsTrue(signature1.IsMatching(signature3));
            Assert.IsFalse(signature1.IsMatching(signature2));
        }
Esempio n. 2
0
        public void BitArray1KEcsSignature_WhenDisableBit_DisablesBit()
        {
            // Arrange
            var signature1 = new BitArray1KEcsSignature();
            var signature2 = new BitArray1KEcsSignature();

            signature1.EnableBit(900);
            signature2.EnableBit(900);
            Assert.IsTrue(signature1.IsMatching(signature2));

            // Act
            signature1.DisableBit(900);

            // Assert
            Assert.IsFalse(signature1.IsMatching(signature2));
        }
Esempio n. 3
0
        public void BitArray1KEcsSignature_WhenEnableBit_CreatesUniqueSignature()
        {
            // Arrange
            var signatures = new BitArray1KEcsSignature[1000];

            // Act
            for (var index = 0; index < signatures.Length; ++index)
            {
                var signature = new BitArray1KEcsSignature();
                signature.EnableBit(index);
                signatures[index] = signature;
            }

            // Assert
            int i = 0;
            var matchingSignatures = signatures.Where(x =>
            {
                ++i;
                return(i < signatures.Length && x.IsMatching(signatures[i]));
            });

            Assert.AreEqual(0, matchingSignatures.Count());
        }