Ejemplo n.º 1
0
        /// <summary>
        /// Queries the database.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <param name="repository">The repository.</param>
        /// <returns></returns>
        public List <Result> QueryDatabase(Request request, IOffenderRepository repository)
        {
            List <Result> output = new List <Result>();

            string query        = Utility.PopulateSearchQuery(request);
            var    offenderList = repository.Search(request);
            int    count        = offenderList.Count();
            int    id           = 1;

            Result result = null;

            foreach (var offender in offenderList)
            {
                result             = new Result();
                result.ResultID    = id++;
                result.TotalCount  = count;
                result.Requester   = request.InquirerEmail;
                result.ReportDate  = DateTime.Now;
                result.SearchQuery = query;
                result.Offender    = offender;

                output.Add(result);
            }
            Trace.TraceInformation($"Populating {count} results for query={query}");

            return(output);
        }
Ejemplo n.º 2
0
        public void Test_Search_No_Filter()
        {
            var request = new Request("*****@*****.**", 100, "", "", 0, 0, null, null, 0, 0, 0, 0, null, null);
            var results = repository.Search(request);
            int count   = results.Count();

            Assert.AreEqual(2, count);
        }