public void ReadMessage_With_Invalid_TravelerID()
 {
     IRepository repo = new EFRepository();
     MessageService ms = new MessageService(repo);
     var message = ms.ReadMessage(new Guid("c085ce65-9fd8-e011-813c-206a8a339500"), new Guid("11111111-1111-1111-1111-111111111111"));
     Assert.IsNotNull(message);
 }
 public void ReadMessage_With_Invalid_MessageID()
 {
     IRepository repo = new EFRepository();
     MessageService ms = new MessageService(repo);
     var message = ms.ReadMessage(new Guid("11111111-1111-1111-1111-111111111111"), new Guid("37519c07-acd4-e011-ad03-206a8a339500"));
     Assert.IsNotNull(message);
 }
 public void ReadMessageTest()
 {
     IRepository repo = new EFRepository();
     MessageService ms = new MessageService(repo);
     var message = ms.ReadMessage(new Guid("c085ce65-9fd8-e011-813c-206a8a339500"), new Guid("37519c07-acd4-e011-ad03-206a8a339500"));
     Assert.IsNotNull(message);
 }
 public void ReadMessage_With_Invalid_TravelerID()
 {
     var mockRepo = new Mock<IRepository>();
     Traveler expected = new Traveler { Firstname = "Nimrod" };
     mockRepo.Setup(m => m.FindBy<Traveler>(t => t.TravelerID == It.IsAny<Guid>())).Returns(expected);
     MessageService ms = new MessageService(mockRepo.Object);
     var actual = ms.ReadMessage(new Guid("c085ce65-9fd8-e011-813c-206a8a339500"), It.IsAny<Guid>());
     mockRepo.VerifyAll();
     Assert.AreEqual(expected, actual);
 }
        public void SendMessage_With_Invalid_AuthorID()
        {
            IRepository repo = new EFRepository();
            MessageService ms = new MessageService(repo);
            Guid author = new Guid("11111111-1111-1111-1111-111111111111");
            Guid[] recipients = new Guid[] {
                new Guid("d0293215-1dd7-e011-ae1d-206a8a339500"),
                new Guid("45d03989-9fd8-e011-813c-206a8a339500") };

            ms.SendMessage("blablabla", "blablablbla?", author, recipients);
        }
        public void SendMessageTest()
        {
            IRepository repo = new EFRepository();
            MessageService ms = new MessageService(repo);
            Guid author = new Guid("37519c07-acd4-e011-ad03-206a8a339500");
            Guid[] recipients = new Guid[] {
                new Guid("d0293215-1dd7-e011-ae1d-206a8a339500"),
                new Guid("45d03989-9fd8-e011-813c-206a8a339500") };

            ms.SendMessage("blablabla", "blablablbla?", author, recipients);
        }
        public void ListMessagesTest()
        {
            IRepository repo = new EFRepository();
            MessageService ms = new MessageService(repo);
            Guid traveler = new Guid("d0293215-1dd7-e011-ae1d-206a8a339500");
            var msgs = ms.ListMessages(traveler, FolderType.Inbox, 0, 5);
            foreach (var item in msgs)
            {
                Trace.WriteLine(String.Format("{0} {1} {2}", item.Message.Subject, item.Message.Author.Fullname, item.Message.SentDate));

            }
        }
 public SendMessageResponse SendMessage(SendMessageRequest sendMsgReq)
 {
     SendMessageResponse response = new SendMessageResponse();
     MessageService msgSvc = new MessageService(_repository);
     try
     {
         msgSvc.SendMessage(sendMsgReq.Subject, sendMsgReq.Body, _currentTravelerId, new Guid[] { new Guid(sendMsgReq.RecipientID) });
         response.MarkSuccess();
     }
     catch (Exception ex)
     {
         ReportError(ex, response);
     }
     return response;
 }
 public ReadMessageResponse ReadMessage(string messageID)
 {
     ReadMessageResponse response = new ReadMessageResponse();
     MessageService msgSvc = new MessageService(_repository);
     try
     {
         TravelerMessage message = msgSvc.ReadMessage(new Guid(messageID), _currentTravelerId);
         response.Message = message.ConvertToMessageView();
         response.MarkSuccess();
     }
     catch (Exception ex)
     {
         ReportError(ex, response);
     }
     return response;
 }
        public ListMessagesResponse ListMessages(string folderName, int index, int count)
        {
            ListMessagesResponse response = new ListMessagesResponse();

            MessageService msgSvc = new MessageService(_repository);
            FolderType folderType;
            if (!Enum.TryParse<FolderType>(folderName, out folderType))
            {
                response.ResponseMessage = String.Format(R.String.ErrorMessages.InvalidFolderName, folderName);
            }
            else
            {
                try
                {
                    response.MessagesList = msgSvc.ListMessages(_currentTravelerId, folderType, index, count).ConvertToMessageViewPagedList();
                    response.MarkSuccess();
                }
                catch (Exception ex)
                {
                    ReportError(ex, response);
                }
            }
            return response;
        }
        public void SendMessage_With_Invalid_Recipients()
        {
            IRepository repo = new EFRepository();
            MessageService ms = new MessageService(repo);
            Guid author = new Guid("37519c07-acd4-e011-ad03-206a8a339500");
            Guid[] recipients = new Guid[] { new Guid("11111111-1111-1111-1111-111111111111") };

            ms.SendMessage("blablabla", "blablablbla?", author, recipients);
        }