private Mobile getConfiguredMobilePhone(MobileModels model)
        {
            MobileFactory factory = MobileFactory.Instance();
            Mobile        mobile  = factory.GetMobile(model, _output);
            var           airPods = new AirPods();

            mobile.ConnectBluetoothSoundDevice(airPods);
            var bluetoothSpeaker = new BluetoothSpeaker();

            mobile.ConnectBluetoothSoundDevice(bluetoothSpeaker);
            return(mobile);
        }
        public void TestThatBluetoothAccessoriesPrintMessageAboutConnection()
        {
            MobileFactory factory = MobileFactory.Instance();
            Mobile        mobile  = factory.GetMobile(MobileModels.SC1102, _output);
            var           airPods = new AirPods();

            mobile.ConnectBluetoothSoundDevice(airPods);
            Assert.AreEqual($"Connection with {airPods.Name} has established.", _output.Output);

            var bluetoothSpeaker = new BluetoothSpeaker();

            mobile.ConnectBluetoothSoundDevice(bluetoothSpeaker);
            Assert.AreEqual($"Connection with {bluetoothSpeaker.Name} has established.", _output.Output);
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            IOutput       output  = new ConsoleOutput();
            MobileFactory factory = MobileFactory.Instance();
            List <Mobile> mobiles = new List <Mobile>(3)
            {
                factory.GetMobile(MobileModels.SC1102, output),
                factory.GetMobile(MobileModels.SC1103, output),
                factory.GetMobile(MobileModels.SC1104, output)
            };
            var simCard1 = new SimCard(MobileOperators.LIFECELL, new List <Modes> {
                Modes.GSM, Modes.THREEG, Modes.FOURG, Modes.LTE
            }, 2);
            var simCard2 = new SimCard(MobileOperators.VODAPHONE, new List <Modes> {
                Modes.GSM, Modes.THREEG
            }, 1);

            simCard1.IsEnabled = true;

            mobiles.ForEach(mobile =>
            {
                mobile.InstallSimCard(simCard1);
                mobile.InstallSimCard(simCard2);
            }
                            );

            mobiles.ForEach(mobile => Console.WriteLine(mobile));

            var mobile1          = mobiles[0];
            var airPods          = new AirPods();
            var bluetoothSpeaker = new BluetoothSpeaker();

            mobile1.ConnectBluetoothSoundDevice(airPods);
            mobile1.ConnectBluetoothSoundDevice(bluetoothSpeaker);
            mobile1.ConnectHeadPhones(new HeadPhones());

            mobile1.PlayMusic();
            Console.ReadKey();

            mobile1.DisconnectBluetoothSoundDevice(airPods);
            mobile1.DisconnectBluetoothSoundDevice(bluetoothSpeaker);

            mobile1.PlayMusic();
            Console.ReadKey();
        }