예제 #1
0
 public Mobile()
 {
     //SMSProvider = SMSProviderFactory.GetSMSProvider("SMSProviderWithTread");
     SMSProvider              = SMSProviderFactory.GetSMSProvider("SMSProviderWithTasks");
     Storage                  = new MyStorage();
     SMSProvider.SMSReceived += (message) => Storage.Add(message);
 }
        public void TestThatEventHandlerHasTriggered()
        {
            var provider = SMSProviderFactory.Instance().GetSMSProvider(SMSProviderType.THREAD, PHONE_NUMBER);

            provider.Start();
            provider.SMSReceived += UnitTestEventHadler;
            Thread.Sleep(4000);
            Assert.AreEqual(true, eventTriggered);
        }
예제 #3
0
 public SimCorpPhone()
 {
     Battery        = new LiIonBattery(3.81, 2716);
     Speaker        = new StereoSpeaker();
     Keyboard       = new CallKeyboard();
     Microphone     = new MobileMicrophone();
     Screen         = new TouchScreen(new TouchManager(), 143.6, 70.9, 2436, 1125, TouchScreenType.MultiTouch);
     Simcard        = new Simcard("+380879879455", "Life");
     MessageStorage = new MessageStorage();
     SMSProvider    = SMSProviderFactory.GetProvider(MessageStorage, SMSProviderType.Task);
 }
예제 #4
0
 public SimcorpMobile()
 {
     vOLEDScreen          = new OLEDScreen();
     speaker              = new SpeakerMono();
     microphoneVolControl = new MicrophoneWithMute();
     key             = new KeyboardWithLock();
     control         = new MultyTouchScreen();
     SMSProvider     = new SMSProvider();
     Storage         = new Storage();
     SMSProviderBase = SMSProviderFactory.GetSMSProvider(Storage);
     Battery         = new Battery();
     Charger         = ChargerFactory.GetCharger(Battery);
 }
예제 #5
0
        public bool SubscribeToProvider(string phoneNumber, SMSProviderType providerType)
        {
            var smsProvider = SMSProviderFactory.Instance().GetSMSProvider(providerType, phoneNumber);

            if (!_smsProviders.Contains(smsProvider))
            {
                _smsProviders.Add(smsProvider);
                smsProvider.SMSReceived += SMSHandler;
                smsProvider.Start();
                Output.WriteLine($"Successfully subscribed to {phoneNumber}.");
                return(true);
            }
            else
            {
                Output.WriteLine($"Cant subscribe to {phoneNumber}, cause subscribtion has already exist.");
            }
            return(false);
        }