Exemplo n.º 1
0
        public void isOnCorrectlyWorkingTest()
        {
            Beacon testBeacon = new Beacon();

            int[] testArray = new int[TEST_NUM] {
                2, 4, 6, 8, 10, 12, 14, 16, 18, 20
            };
            testBeacon.giveSignalInput(testArray);
            testBeacon.turnOn();
            Assert.AreEqual(testBeacon.emitSignal(), "0");

            testBeacon.turnOn();
            Assert.AreEqual(testBeacon.emitSignal(), "WuBWuBWuBWuBWuBWuBWuBWuBWuBWuB");
        }
Exemplo n.º 2
0
        // Pre: None
        // Post: A beacon object will be instantiated.
        private void whoAmIBeacon(int BType)
        {
            if (BType == 1)
            {
                BComposite = new Beacon();
            }

            else if (BType == 2)
            {
                BComposite = new StrobeBeacon();
            }

            else if (BType == 3)
            {
                BComposite = new QuirkyBeacon();
            }
        }
Exemplo n.º 3
0
        public void turnOffIfNotCharged()
        {
            Beacon testBeacon = new Beacon();

            int[] testArray = new int[TEST_NUM] {
                2, 4, 6, 8, 10, 12, 14, 16, 18, 20
            };
            string signal;

            for (int i = 0; i < TEST_NUM; i++)
            {
                testBeacon.giveSignalInput(testArray);
                signal = testBeacon.emitSignal();
            }

            Assert.AreEqual(testBeacon.emitSignal(), "0");
        }