/// <summary>
 /// Method for populating the DataSource with all Call Logs for a specific Job,
 /// filtered accordingly to a User inputed Parameter
 /// </summary>
 public void ListFilteredCallLogs()
 {
     if (null != _view.JobId)
     {
         try
         {
             using (_callLogModel = new CallLogModel())
             {
                 if (string.Empty == _view.FilterValue)
                 {
                     _view.DataSource = _callLogModel.ListAllJobCallLogs(_view.JobId.Value).OrderBy(e => e.CallDate).ToList();
                 }
                 else
                 {
                     _view.DataSource = _callLogModel.ListFilteredCallLogs(_view.FilterType, _view.FilterValue, _view.JobId.Value).OrderBy(e => e.CallDate).ToList();
                 }
             }
         }
         catch (Exception ex)
         {
             Logger.Write(string.Format("There was an error loading the Filtered Call Log List!\n{0}\n{1}", ex.Message, ex.StackTrace));
             _view.DisplayMessage("There was an error loading the Filtered Call Log List", false);
         }
     }
 }
 public void BindJobCallLog()
 {
     using (_callLogModel = new CallLogModel())
     {
         if (_view.JobId.HasValue)
             _view.JobCallLogGridDataSource = _callLogModel.ListAllJobCallLogs(_view.JobId.Value);
     }
 }
        public void ShouldReturnEmptyListtIfCallLogRelatedToJobIsNotFound()
        {
            //Arrange
            FakeObjectSet<CS_CallLog> fakeCallLogList = new FakeObjectSet<CS_CallLog>();
            fakeCallLogList.AddObject(new CS_CallLog() { ID = 1, JobID = 1, Active = true });
            Mock<IUnitOfWork> mockUnitOfWork = new Mock<IUnitOfWork>();
            mockUnitOfWork.Setup(e => e.CreateObjectSet<CS_CallLog>()).Returns(fakeCallLogList);
            CallLogModel model = new CallLogModel(mockUnitOfWork.Object);

            //Act
            IList<CS_CallLog> callLogList = model.ListAllJobCallLogs(2);

            //Assert
            Assert.IsNotNull(callLogList);
            Assert.AreEqual(0, callLogList.Count);
        }