public async Task TestAddFavorite() { var userFavoriteAppService = Substitute.For <IUserFavoriteAppService>(); userFavoriteAppService.AddEmployeeAsync(User_Id, Arg.Any <Guid>()) .Returns(Task.FromResult(true)); var target = new EmployeeController( CreateMemoryCache(), CreateMapper(), Substitute.For <IDepartmentAppService>(), Substitute.For <IPositionAppService>(), Substitute.For <IEmployeeAppService>(), Substitute.For <IGroupAppService>(), _ => userFavoriteAppService, _ => Substitute.For <IUserSettingAppService>()); target.ControllerContext = CreateMockContext(); var result = await target.AddFavorite(Guid.NewGuid()); result.Value.Status.Should().Be(0); }