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);
        }
        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]);
            }
             }
        }
Exemple #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);
 }