private void SMSViewerForm_Load(object sender, EventArgs e)
        {
            MobileFactory factory = MobileFactory.Instance();

            _output = new WindowsFormOutput(messagesListView, systemOutputTextBox);
            _mobile = factory.GetMobile(_model, _output);
            _mobile.SetChargeLevelChangedHandler(ChargeLevelChangedHandler);

            FormatUtils.formatOptions.ForEach(value => formatOptionsComboBox.Items.Add(value));
            formatOptionsComboBox.SelectedIndex = 0;

            _charger = BatteryChargerFactory.Instance().GetBatteryCharger(BatteryChargerType.THREAD, 3);
            _charger.Start();

            var chargerTypes = Enum.GetValues(typeof(BatteryChargerType));

            foreach (var chargerType in chargerTypes)
            {
                chargerTypeComboBox.Items.Add(chargerType);
            }
            chargerTypeComboBox.SelectedIndex = 0;

            var providerTypes = Enum.GetValues(typeof(SMSProviderType));

            foreach (var providerType in providerTypes)
            {
                providerTypeComboBox.Items.Add(providerType);
            }
            providerTypeComboBox.SelectedIndex = 0;
        }
        private void chargerTypeComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            var chargerTypeString = chargerTypeComboBox.SelectedItem.ToString();
            var chargerType       = (BatteryChargerType)Enum.Parse(typeof(BatteryChargerType), chargerTypeString);

            if (_mobile.IsCharging())
            {
                _mobile.DisconnectCharger(_charger);
            }
            _charger.Stop();
            _charger = BatteryChargerFactory.Instance().GetBatteryCharger(chargerType, 3);
            _charger.Start();
            _output.WriteLine($"{chargerType.ToString()} selected for charging.");
        }
        private void TestThatBatteryChargeLevelIncreasedWhenChargerIsConnected(BatteryChargerType type)
        {
            int value = _battery.ChargeLevel;

            _discharger.Start();
            BatteryCharger charger = BatteryChargerFactory.Instance().GetBatteryCharger(type, CHARGE_VALUE);

            charger.Charge += _battery.IncreaseChargeLevel;
            charger.Start();

            Thread.Sleep(Convert.ToInt32(Math.Max(_discharger.DischargePeriod * 1.1,
                                                  charger.ChargePeriod * 1.1)));
            if (Math.Abs(DISCHARGE_VALUE) / _discharger.DischargePeriod >= CHARGE_VALUE / charger.ChargePeriod)
            {
                Assert.True(value >= _battery.ChargeLevel);
            }
            else
            {
                Assert.True(value < _battery.ChargeLevel);
            }
        }