Exemplo n.º 1
0
 public void DeleteAirPods(AirPods airPods)
 {
     if (airPods != null)
     {
         _db.AirPodses.Remove(airPods);
     }
     _db.SaveChanges();
 }
Exemplo n.º 2
0
        public void EditAirPods(AirPods airPods, Action <AirPods> editAction)
        {
            var airP = GetAirPodsByProp(x => x.Id == airPods.Id);

            if (airP != null)
            {
                editAction(airP);
            }
            _db.SaveChanges();
        }
        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);
        }
Exemplo n.º 4
0
        public void Play_AirPods()
        {
            //Arrange
            FakeOutput fakeOutput = new FakeOutput();
            var        expected   = "Do you hear this test sound? Me too\n";
            //Act
            AirPods airPods = new AirPods(volume: 75, fakeOutput);

            airPods.Play("Do you hear this test sound? Me too\n");
            //Assert
            Assert.AreEqual(expected, fakeOutput.GetOutputAsText());
        }
Exemplo n.º 5
0
 public IActionResult Create([Bind("Id,AirPodsModel," +
                                   "WirelessCharging,YearOfProduction," +
                                   "Price,Description,AmountOfProduct")] AirPods pods)
 {
     if (ModelState.IsValid)
     {
         _airPodsRepository.CreateAirPods(pods);
         return(RedirectToAction("Details", "AirPods", new AirPods {
             Id = pods.Id
         }));
     }
     return(View());
 }
        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);
        }
Exemplo n.º 7
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();
        }
Exemplo n.º 8
0
        public IActionResult Edit(int id, [Bind("Id,AirPodsModel," +
                                                "WirelessCharging,YearOfProduction," +
                                                "Price,Description,AmountOfProduct")] AirPods pods)
        {
            if (id != pods.Id)
            {
                return(NotFound());
            }

            var m = _airPodsRepository.GetAirPodsByProp(x => x.Id == id);

            _airPodsRepository.EditAirPods(m, x =>
            {
                x.AirPodsModel     = pods.AirPodsModel;
                x.WirelessCharging = pods.WirelessCharging;
                x.YearOfProduction = pods.YearOfProduction;
                x.Price            = pods.Price;
                x.Description      = pods.Description;
                x.AmountOfProduct  = pods.AmountOfProduct;
            });
            return(RedirectToAction("Details", "AirPods", new AirPods {
                Id = id
            }));
        }
Exemplo n.º 9
0
 public void CreateAirPods(AirPods airPods)
 {
     _db.AirPodses.Add(airPods);
     _db.SaveChanges();
 }