更新时间:2023-02-17 08:07:33
您必须设置模拟程序以驱动测试用例的执行.
You have to setup your mock to drive the execution of your test case.
例如,如果要通过此行: if(!_genreRepo.SubGenreExist(subGenreId))
For example if you want to go through this line: if (!_genreRepo.SubGenreExist(subGenreId))
然后,您必须设置以下模拟行为:
then you have to setup the following mock behaviour:
subGenreRepositoryMock.Setup(repo => repo.SubGenreExist(It.IsAny<Guid>)).Returns(true);
要到达此行: return NoContent();
,您可能还需要设置其他两种方法来驱动测试用例.
To reach this line: return NoContent();
you might need to setup the other two methods as well to drive your test case.