Я использую NSubstitute, чтобы смоделировать результат REST API servicestack, который возвращает объект сотрудника.
var mockedCoreService = Substitute.For<jsonClient>(ApiUrl);
//Create the employee to return for mocking
var employee = new EmployeeDTO { SSN = "123695874"};
// Get the mocked employee whenver GetEmployee API call is made
mockedCoreService.Get(Arg.Any<GetEmployee>()).Returns(employee);
Вызов API Getemployee принимает Id в качестве параметра, я хочу вернуть другого сотрудника на основе отправленного Id.
//check the id parameter of GetEmployee and return employee based on the condition in below statement
mockedCoreService.Get(Arg.Any<GetEmployee>()).Returns(employee);
Я не уверен, как это сделать.Пожалуйста, помогите.
Спасибо, Amol