public static void Set_InvalidIndex_ThrowsArgumentOutOfRangeException()
        {
            WireReadyBitArray WireReadyBitArray = new WireReadyBitArray(4);

            Assert.Throws <ArgumentOutOfRangeException>(() => WireReadyBitArray.Set(-1, true));
            Assert.Throws <ArgumentOutOfRangeException>(() => WireReadyBitArray.Set(WireReadyBitArray.Length, true));

            Assert.Throws <ArgumentOutOfRangeException>(() => WireReadyBitArray[-1] = true);
            Assert.Throws <ArgumentOutOfRangeException>(() => WireReadyBitArray[WireReadyBitArray.Length] = true);
        }
        public static void Get_Set(bool def, bool[] newValues)
        {
            WireReadyBitArray WireReadyBitArray = new WireReadyBitArray(newValues.Length, def);

            for (int i = 0; i < newValues.Length; i++)
            {
                WireReadyBitArray.Set(i, newValues[i]);
                Assert.AreEqual(newValues[i], WireReadyBitArray[i]);
                Assert.AreEqual(newValues[i], WireReadyBitArray.Get(i));
            }
        }
예제 #3
0
        public void Test_WireReady_Index_Enumerable_Does_Not_Throw()
        {
            //arrange
            WireReadyBitArray bitArray = new WireReadyBitArray(16);

            //act
            bitArray.Set(3, true);

            //assert
            for (int i = 0; i < 16; i++)
            {
                Assert.DoesNotThrow(() => bitArray.Get(i));
            }

            Assert.AreEqual(16, bitArray.Length);
            Assert.DoesNotThrow(() => bitArray.EnumerateSetBitsByIndex().ToArray());
        }