при попытке аргумента конструктора модульного теста передать ошибку - PullRequest
0 голосов
/ 19 марта 2019

X блок тестирования класса

       public class JournalHistoryPageViewModelTests
               {
                  private readonly JournalHistoryPageViewModel _journalHistoryPageViewModel;
                 private readonly Mock<IJournalHistoryService> _journalHistoryService;


                   public   JournalHistoryPageViewModelTests()
                   {

            _journalHistoryService = new Mock<IJournalHistoryService>();
            _journalHistoryPageViewModel = new JournalHistoryPageViewModel(_journalHistoryService.Object);
            _journalHistoryService.SetupGet<Task<List<JournalModel>>>(m => m.GetJounralsAsync(It.IsAny<PatientViewModel>(),It.IsAny<int> 
              (),It.IsAny<FilterType>(),It.IsAny<JournalType>())).**Returns(new Task<List<JournalModel>>());**

            BaseClassValuesUpdate();


                        }


private void BaseClassValuesUpdate()
{
    _journalHistoryPageViewModel.JournalGroup = new JournalGroup() { Type = JournalType.Documents };
    var patientViewModel = new PatientViewModel(new PatientInfo());

    _journalHistoryPageViewModel.SelectedPatient=patientViewModel;
}

Я получаю эту ошибку, я думаю, проблема в жирной части Может кто-нибудь подсказать, что делать

Код серьезности Описание Состояние подавления строки файла проекта Ошибка CS1729 «Задача» не содержит конструктор, который принимает 0 аргументов

модель моего журнала

public class JournalModel
      {
public string Title { get; set; }
public DateTime DateTime { get; set; }
public string Author { get; set; }
public string PatientId { get; set; }
public string DateTimeFormated { get; set; }
public JournalType Type { get; set; } 
public string Uri { get; set; }


 }

здесь IJournalHistoryService.cs

     public interface IJournalHistoryService
     {



Task<List<JournalModel>> GetJounralsAsync(PatientViewModel patient, int pageNumber, FilterType sortingMethod, JournalType journalType);



/// <summary>
/// Retrieves Count of Documents to respective Patient 
/// </summary>
/// <param name="patient">Patient</param>
/// <returns>CountofDocuments</returns>
int GetJournalsCount(PatientViewModel patient, JournalType journalType);

/// <summary>
/// Sorts Documents according to sortingType
/// </summary>
/// <param name="sortingMethod">Page Method of Sorting</param>
void SortByType(FilterType sortingType);

}

...