public SendManySms() { InitializeComponent(); smsPhone1 = new SmsPhone(FormFactor.Bar, "BP20200406"); smsPhone1.AddSimCard(new SimCard(), output); smsPhone2 = new SmsPhone(FormFactor.Bar, "BP20200409"); smsPhone2.AddSimCard(new SimCard(), output); smsPhone3 = new SmsPhone(FormFactor.Bar, "BP20200406"); smsPhone3.AddSimCard(new SimCard(), output); smsPhone4 = new SmsPhone(FormFactor.Bar, "BP20200409"); smsPhone4.AddSimCard(new SimCard(), output); output = new TextBoxOutput(this.receivedSms); var contact1 = smsPhone1.GetMyContact("Alex"); var contact2 = smsPhone2.GetMyContact("Vova"); var contact3 = smsPhone3.GetMyContact("Stas"); var contact4 = smsPhone4.GetMyContact("Oleg"); smsPhone1.AddContact(contact2, contact3, contact4); smsPhone2.AddContact(contact1); smsPhone3.AddContact(contact1); smsPhone4.AddContact(contact1); phones = new IPhone[] { smsPhone1, smsPhone2, smsPhone3, smsPhone4 }; smsFormatting.DataSource = Enum.GetNames(typeof(TextBoxOutput.FormatingStyle)); cmbWords.DataSource = new List <string>() { FILTER_ALL_VALUES }.Concat(words).ToArray(); cmbLogic.DataSource = Enum.GetNames(typeof(LogicOperand)); dtpFrom.CustomFormat = "dd/MM/yyyy hh:mm:ss"; dtpTo.CustomFormat = "dd/MM/yyyy hh:mm:ss"; resetFilters(); sendSms = delegate { int arrLength = words.Length - 1; smsPhone1.SendSms($"smsVSO|{words[random.Next(arrLength)]}|{smsCount++}", output, 0, "Vova", "Stas", "Oleg"); smsPhone2.SendSms($"smsVA|{words[random.Next(arrLength)]}|{smsCount++}", output, 0, "Alex"); smsPhone3.SendSms($"smsSA|{words[random.Next(arrLength)]}|{smsCount++}", output, 0, "Alex"); smsPhone4.SendSms($"smsOA|{words[random.Next(arrLength)]}|{smsCount++}", output, 0, "Alex"); cbxSubscribers.DataSource = getAllSenders(phones); }; powerbank = new PowerBank("PB20200430"); powerbank.PluginToUse = Plugins.Usb; }
public void FilteringSms(string subString, string receivedFrom, LogicOperand logic, string fromTo, int expectedResults) { DateTime from, to; SetDates(fromTo, out from, out to); GeneralPhone smsPhone1 = new SmsPhone(FormFactor.Bar, "BP20200406"); smsPhone1.AddSimCard(new SimCard()); GeneralPhone smsPhone2 = new SmsPhone(FormFactor.Bar, "BP20200409"); smsPhone2.AddSimCard(new SimCard()); var contact2 = smsPhone2.GetMyContact("Vova"); smsPhone1.AddContact(contact2); int i = 0; foreach (string word in words) { smsPhone1.SendSms(smsText: $"Test Message {i++} {word}", names: "Vova"); } FilterParams filterParams = new FilterParams() { SubString = subString, ReceivedFrom = receivedFrom, Logic = logic, From = from, To = to }; Func <IEnumerable <GeneralPhone>, FilterParams, ListViewItem[]> filterChanged = UpdateFiltering; ListViewItem[] lvItems = filterChanged(new List <GeneralPhone>() { smsPhone1, smsPhone2 }, filterParams); Assert.AreEqual(words.Length, smsPhone1.UseComponent <Memory>().Get <SmsMessage>().Count()); Assert.AreEqual(words.Length, smsPhone2.UseComponent <Memory>().Get <SmsMessage>().Count()); Assert.AreEqual(expectedResults, lvItems.Count()); }
public SendManySms() { InitializeComponent(); smsPhone1 = new SmsPhone(FormFactor.Bar, "BP20200406"); smsPhone1.AddSimCard(new SimCard(), output); smsPhone2 = new SmsPhone(FormFactor.Bar, "BP20200409"); smsPhone2.AddSimCard(new SimCard(), output); smsPhone3 = new SmsPhone(FormFactor.Bar, "BP20200406"); smsPhone3.AddSimCard(new SimCard(), output); smsPhone4 = new SmsPhone(FormFactor.Bar, "BP20200409"); smsPhone4.AddSimCard(new SimCard(), output); output = new TextBoxOutput(this.receivedSms); var contact1 = smsPhone1.GetMyContact("Alex"); var contact2 = smsPhone2.GetMyContact("Vova"); var contact3 = smsPhone3.GetMyContact("Stas"); var contact4 = smsPhone4.GetMyContact("Oleg"); smsPhone1.AddContact(contact2, contact3, contact4); smsPhone2.AddContact(contact1); smsPhone3.AddContact(contact1); smsPhone4.AddContact(contact1); phones = new GeneralPhone[] { smsPhone1, smsPhone2, smsPhone3, smsPhone4 }; smsFormatting.DataSource = Enum.GetNames(typeof(TextBoxOutput.FormatingStyle)); cmbWords.DataSource = new List <string>() { FILTER_ALL_VALUES }.Concat(words).ToArray(); cmbLogic.DataSource = Enum.GetNames(typeof(LogicOperand)); dtpFrom.CustomFormat = "MM/dd/yyyy hh:mm:ss"; dtpTo.CustomFormat = "MM/dd/yyyy hh:mm:ss"; resetFilters(); }