Example #1
0
        public async Task <List <AcceptedLeadsResponse> > GetLeadsWithAcceptedStatus()
        {
            var jobs = await _context.Jobs
                       .Where(s => s.Status == LeadStatusType.Accepted.ToString())
                       .Include(x => x.Suburb)
                       .Include(x => x.Category)
                       .ToListAsync();

            return(JobsMapper.ToAcceptedLeadsResponse(jobs));
        }
Example #2
0
        public async Task Should_Return_List_of_AcceptedLeadsResponse_object_Given_List_of_Jobs_object()
        {
            var dbContext = await InMemoryMockDbContext.GetDatabaseContext();

            var jobs = dbContext.Jobs.ToList();

            var leadResp = JobsMapper.ToAcceptedLeadsResponse(jobs);

            Assert.NotNull(leadResp);
            Assert.AreEqual(leadResp.Count, jobs.Count);
            Assert.AreEqual(leadResp[0].Id, jobs[0].Id);
            Assert.AreEqual(leadResp[0].ContactName, jobs[0].ContactName);
            Assert.AreEqual(leadResp[0].CreatedDateTime, jobs[0].CreatedAt.DateTime);
            Assert.AreEqual(leadResp[0].Suburb, jobs[0].Suburb.Name);
            Assert.AreEqual(leadResp[0].CategoryName, jobs[0].Category.Name);
            Assert.AreEqual(leadResp[0].Description, jobs[0].Description);
            Assert.AreEqual(leadResp[0].Price, jobs[0].Price.ToString());
            Assert.AreEqual(leadResp[0].Postcode, jobs[0].Suburb.Postcode);
        }