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个参数的构造函数DipsDemoXaml.XUnitTest C:\ Users \ Ishara.M \ source \ repos \ Visit-Xamarin.Forms \ DipsDemoXaml.XUnitTest \ ViewModelTest \ JournalHistoryPageViewModelTests.cs 28活动
我的日记模型
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);
}