public async Task SearchByIds_Ok() { //Setup var model = new ProfilesQueryModel() { Ids = new List <Guid>() }; var serviceMock = new Mock <IProfileService>(); serviceMock .Setup(x => x.SearchByIdsAsync(model.Ids)) .ReturnsAsync(new List <Profiles.Profile>()); var client = TestServerHelper.New(collection => { collection.AddScoped(_ => serviceMock.Object); }); //Act var response = await client.PostAsync($"profiles/search", model.AsJsonContent()); //Assert Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); }
public async Task <ActionResult <IEnumerable <Profile> > > SearchByIdsAsync([FromBody] ProfilesQueryModel model) { var profiles = await profileService.SearchByIdsAsync(model.Ids); return(Ok(profiles)); }