コード例 #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");
        }
コード例 #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();
            }
        }
コード例 #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");
        }