コード例 #1
0
        public void GetQuantityPeopleByName()
        {
            var person = new Person {
                Name = "Nome"
            };
            var person2 = new Person {
                Name = "Nome"
            };
            var person3 = new Person {
                Name = "Nome"
            };

            var busPublisher     = new Mock <IBusEventPublisher>();
            var personRepository = new Mock <IPersonRepository>();

            personRepository.Setup(repo => repo.GetPersonByConcatenationFilterCondition(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(),
                                                                                        It.IsAny <ColorType?>(), It.IsAny <LevelEducationType?>())).ReturnsAsync(new List <Person> {
                person, person2, person3
            });
            var a = new List <Person>();

            QuantityPeopleByManyFiltersQuery        query   = new QuantityPeopleByManyFiltersQuery();
            QuantityPeopleByManyFiltersQueryHandler handler = new QuantityPeopleByManyFiltersQueryHandler(personRepository.Object);

            QuantityPeopleByManyFiltersQueryDto result = handler.Handle(query, new System.Threading.CancellationToken()).Result;

            Assert.NotNull(result);
            Assert.True(result.Quantity == 3);

            personRepository.Verify(m => m.GetPersonByConcatenationFilterCondition(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(),
                                                                                   It.IsAny <ColorType?>(), It.IsAny <LevelEducationType?>()), Times.Once);
        }
コード例 #2
0
        public async Task <IActionResult> QuantityPeopleByManyFilters(string name, string lastName, string Region, ColorType color, LevelEducationType levelEducation)
        {
            QuantityPeopleByManyFiltersQueryDto result = await _mediator.Send(new QuantityPeopleByManyFiltersQuery { Name = name, LastName = lastName, Region = Region, ColorFilter = color, LevelEducationFilter = levelEducation });

            return(Ok(result));
        }