Ejemplo n.º 1
0
            public async Task <Result> Handle(Query request, CancellationToken cancellationToken)
            {
                var pins = await _flatSwedishPersonalIdentityNumbersTestdataProvider.GetFlatSwedishPersonalIdentityNumbersAsync();

                var pinsList = pins.ToList();

                var random  = new Random();
                var numbers = Enumerable.Range(0, request.Count ?? 5)
                              .Select(x => pinsList[random.Next(pinsList.Count)])
                              .ToList();

                return(new Result(numbers));
            }
Ejemplo n.º 2
0
            private async Task <Result> Handle(QueryBase request, CancellationToken cancellationToken)
            {
                var testdata = await _flatSwedishPersonalIdentityNumbersTestdataProvider.GetFlatSwedishPersonalIdentityNumbersAsync();

                var testdataList         = testdata.ToList();
                var filteredTestdata     = ApplyFilters(request, testdataList.AsEnumerable());
                var filteredTestdataList = filteredTestdata.ToList();
                var paginatedTestData    = Paginate(request, filteredTestdataList);

                var totalAgeRange = new Range <int>
                {
                    From = testdataList.Where(x => x.AgeHint.HasValue).Min(x => x.AgeHint),
                    To   = testdataList.Where(x => x.AgeHint.HasValue).Max(x => x.AgeHint)
                };

                var totalDateOfBirthRange = new Range <DateTime>
                {
                    From = testdataList.Min(x => x.DateOfBirthHint),
                    To   = testdataList.Max(x => x.DateOfBirthHint)
                };

                return(new Result(paginatedTestData, filteredTestdataList.Count, testdataList.Count, totalAgeRange, totalDateOfBirthRange));
            }