testcase to check item is null or not.
C#
foreach (var fileName in filelist)
{
var item = await fileInfoContextService.GetFileInfo(projectId, fileName);
if (item == null)
{
await fileInfoContextService.InsertFileInfo(projectId, fileName, FileStatus.NotStarted);
}
}
Mario ScheerenRank #1,371 · 1.2K reputationPosted Jan 13, 2022, 10:54 AM EST
Test the methods not the foreach.
Test1 fileInfoContextService.GetFileInfo expect positive
Test2 fileInfoContextService.GetFileInfo expect negative / exception
Test3 fileInfoContextService.InsertFileInfo expect positive
Test4 fileInfoContextService.InsertFileInfo expect negative / exception