Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <IEnumerable <Profile> > > SearchByIdsAsync([FromBody] ProfilesQueryModel model)
        {
            var profiles = await profileService.SearchByIdsAsync(model.Ids);

            return(Ok(profiles));
        }