예제 #1
0
        public void PhoneSpeakerTestMethod()
        {
            //arrange
            vNokia1100.PlaybackComponent = HeadsetFactory.GetHeadset(Headsets.PhoneSpeaker, vFakeOutput);
            string controlValue = "\nPhoneSpeaker playback selected" +
                                  "\nSet playback to mobile..." +
                                  "\nPlay sound in mobile" +
                                  "\nPhoneSpeaker sound: Hi";

            //act
            vNokia1100.Play("Hi");
            //assert
            Assert.AreEqual(controlValue, vFakeOutput.Output);
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            textBox1.Clear();
            output = new WFAOutput(textBox1);

            MyMobile.PlaybackComponent = HeadsetFactory.GetPlayback((headsetTypik)checkedListBox1.SelectedIndex, output);
            MyMobile.PlaybackComponent.Play(textBox1);

            MyMobile.SimCardItem = SimCardFactory.GetSimCard((SimCardTypeik)checkedListBox2.SelectedIndex, output);
            MyMobile.SimCardItem.Call(textBox1);

            MyMobile.ChargerComponenet = ChargerFactory.GetCharger((ChargerTypik)checkedListBox3.SelectedIndex, output);
            MyMobile.ChargerComponenet.Charge(textBox1);
        }
예제 #3
0
        static void Main(string[] args)
        {
            ConsoleOutput outputType = new ConsoleOutput();

            HeadsetTypes inputHSType   = ReadHeadSet(outputType);
            ChargerTypes inputChrgType = ReadCharger(outputType);

            IPlayback headset = HeadsetFactory.GetHeadSet(outputType, inputHSType);
            ICharger  charger = ChargerFactory.GetCharger(inputChrgType);

            var mymobile = new SimCorpMobile(headset, charger, outputType);

            Console.WriteLine(mymobile);
            Console.ReadKey();
        }
예제 #4
0
 private void SetHeadSetType()
 {
     if (this.rbHeadSetiPhone.Checked)
     {
         vHeadset = HeadsetFactory.GetHeadSet(this.vOutputType, HeadsetTypes.iPhone);
     }
     else if (this.rbHeadSetSamsung.Checked)
     {
         vHeadset = HeadsetFactory.GetHeadSet(this.vOutputType, HeadsetTypes.Samsung);
     }
     else if (this.rbHeadSetEFStealth.Checked)
     {
         vHeadset = HeadsetFactory.GetHeadSet(this.vOutputType, HeadsetTypes.EarForceStealth);
     }
 }
예제 #5
0
        private static Mobile InstantiateSimCorpMobile(IOutput myOutputType)
        {
            Mobile mobile = null;

            ICharger  Charger = ChargerFactory.GetCharger(ChargerTypes.Powerbk);
            IPlayback Headset = HeadsetFactory.GetHeadSet(myOutputType, HeadsetTypes.iPhone);

            if (Charger != null)
            {
                if (Headset != null)
                {
                    mobile = new SimCorpMobile(Headset, Charger, myOutputType);
                }
            }
            return(mobile);
        }
예제 #6
0
        public void ConfigureMobile()
        {
            int headsetType = defineEnumParam(typeof(headsetTypik));

            PlaybackComponent = HeadsetFactory.GetPlayback((headsetTypik)headsetType, output);
            PlaybackComponent.Play(new object());

            int chargerType = defineEnumParam(typeof(ChargerTypik));

            ChargerComponenet = ChargerFactory.GetCharger((ChargerTypik)chargerType, output);
            ChargerComponenet.Charge(new object());

            int simcardType = defineEnumParam(typeof(SimCardTypeik));

            SimCardItem = SimCardFactory.GetSimCard((SimCardTypeik)simcardType, output);
            SimCardItem.Call(new object());
        }
예제 #7
0
        static void Main(string[] args)
        {
            try
            {
                var console = new ConsoleOutput();

                MobilePhoneBase myNokia1100 = new Nokia1100(777);

                Console.WriteLine("Select playback component:");
                Console.WriteLine("1 - iPhoneHeadset");
                Console.WriteLine("2 - SamsungHeadset");
                Console.WriteLine("3 - UnofficialiPhoneHeadset");
                Console.WriteLine("4 - PhoneSpeaker");
                int playbackNumber = readNumber();
                myNokia1100.PlaybackComponent = HeadsetFactory.GetHeadset((Headsets)playbackNumber, console);
                myNokia1100.PlaybackComponent.Play("Hi");

                Console.WriteLine();

                Console.WriteLine("Select charger component:");
                Console.WriteLine("1 - FastCharge");
                Console.WriteLine("2 - UsualCharge");
                int chargerNumber = readNumber();
                myNokia1100.ChargerComponent = ChargeFactory.GetCharge((Charges)chargerNumber, console);
                myNokia1100.Charge();

                Console.ReadKey();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Console.ReadKey();
            }
            finally
            {
                Console.WriteLine("Goodbye");
            }
        }
 private void button_ApplyPlayback_Click(object sender, EventArgs e)
 {
     Nokia1100.PlaybackComponent = HeadsetFactory.GetHeadset(currentHeadsets, formOutput);
     Nokia1100.Play("Hi");
 }