コード例 #1
0
 private void SMSHandler(SMSProvider provider, SMSMessage message)
 {
     try
     {
         SMSStorage.SaveSMSMessage(message);
         var count = SMSStorage.GetNumberOfUnreadMessages();
         Output.WriteLine($"New message from {message.From}, you have {count} unread messages.");
     }
     catch (SMSStorageMemoryOverflow ex)
     {
         Output.WriteLine(ex.Message);
     }
 }
コード例 #2
0
 public void TestInitialize()
 {
     _smsStorage.DeleteAllSMSMessages();
     for (var i = 0; i < PHONE_NUMBER1_COUNT; i++)
     {
         _smsStorage.SaveSMSMessage(new SMSMessage(Guid.NewGuid(), PHONE_NUMBER1, TEXT_MESSAGE + i, DateTime.Now, _smsProvider1));
     }
     for (var i = 0; i < PHONE_NUMBER2_COUNT; i++)
     {
         _smsStorage.SaveSMSMessage(new SMSMessage(Guid.NewGuid(), PHONE_NUMBER2, TEXT_MESSAGE + i, DateTime.Now, _smsProvider2));
     }
 }