Пример #1
0
        public void BinaryArrayInByteConstructorTest()
        {
            BinaryArrayInByte target = new BinaryArrayInByte();
            byte received            = target.GetValue();

            Assert.IsTrue(received == 0, "Expected 0 but received " + received);

            target   = new BinaryArrayInByte(new bool[] { true, false, true, false, true, false, true, false });
            received = target.GetValue();
            Assert.IsTrue(received == 85, "Expected 85 but received " + received);

            target   = new BinaryArrayInByte(new bool[] { false, true, false, true, false, true, false, true });
            received = target.GetValue();
            Assert.IsTrue(received == 170, "Expected 170 but received " + received);
        }
Пример #2
0
        public void ItemTest()
        {
            BinaryArrayInByte target = new BinaryArrayInByte();
            Random            r      = new Random();

            for (int pass = 1; pass < 4; pass++)
            {
                bool[] expected = new bool[8];

                for (int i = 0; i < 8; i++)
                {
                    expected[i] = (r.Next(2) == 1);
                    target[i]   = expected[i];
                }

                // read the values and compare with the expected
                for (int i = 0; i < 8; i++)
                {
                    bool received = target[i];
                    Assert.IsTrue(received == expected[i], "Stored data do not match at index " + i + "; pass: "******"; received: " + received.ToString() + "; expected: " + expected[i]);
                }
            }
        }
Пример #3
0
 /// <summary>
 /// This method is called when the box initialization is complete
 /// </summary>
 protected override void OnInitialized()
 {
     _HiddenSides = new BinaryArrayInByte();
     _Material    = Material.GetMaterial(MaterialId);
 }