예제 #1
0
        public void ChargeBatteryTestCommonCase()
        {
            mockOutput.Clear();
            IOutput output    = mockOutput;
            string  expected  = "iChargeUnit is charging phone.\r\n";
            var     chargeObj = new iChargeUnit(output);

            chargeObj.ChargeBattery(null);
            string actual = output.ToString();

            Assert.AreEqual(expected, actual);
        }
예제 #2
0
        public void Error_0()
        {
            Description desc = new Description("width", "The rectangle width", eROLE.NAMED, new ParamString(),
                                               eSCOPE.REQUIRED,
                                               eMULTIPLICITY.ONCE);

            MockOutput     mock     = new MockOutput();
            OutputMessages messages = new OutputMessages(CliOptions.WindowsStyle, mock);

            mock.Clear();
            messages.Error(desc, eERROR.REQUIRED);
            CollectionAssert.AreEqual(new[] { "GemsCLI: option '/width' is required." }, mock.getLines());

            mock.Clear();
            messages.Error(desc, eERROR.DUPLICATE);
            CollectionAssert.AreEqual(new[] { "GemsCLI: option '/width' can only be used once." }, mock.getLines());

            mock.Clear();
            messages.Error(desc, eERROR.MISSING_VALUE);
            CollectionAssert.AreEqual(new[] { "GemsCLI: option '/width' is missing value." }, mock.getLines());
        }
예제 #3
0
        public void PlayTestCommonCase()
        {
            mockOutput.Clear();
            IOutput output   = mockOutput;
            string  expected = "iPhoneHeadset play sound.\r\n";
            var     phoneObj = new iPhoneHeadset(output);

            phoneObj.Play(null);
            string actual = output.ToString();

            Assert.AreEqual(expected, actual);
        }
예제 #4
0
        public void ConnectToOperatorTestCommonCase()
        {
            mockOutput.Clear();
            IOutput output   = mockOutput;
            string  expected = "KievStar operator is connected.\r\n";
            var     simCard  = new KievStarSimCard(output);

            simCard.ConnectToOperator(null);
            string actual = output.ToString();

            Assert.AreEqual(expected, actual);
        }