public async Task Should_Return_All_Leads_With_Accepted_Status() { var dbContext = await InMemoryMockDbContext.GetDatabaseContext(); var leadHandlerRepository = new LeadHandlerRepository(dbContext); var leads = await leadHandlerRepository.GetLeadsWithAcceptedStatus(); Assert.NotNull(leads); Assert.AreEqual(3, leads.Count); }
public async Task Should_Return_List_of_InvitedLeadsResponse_object_Given_List_of_Jobs_object() { var dbContext = await InMemoryMockDbContext.GetDatabaseContext(); var jobs = dbContext.Jobs.ToList(); var leadResp = JobsMapper.ToInvitedLeadsResponse(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()); }
public async Task Should_Return_LeadResponse_object_Given_Jobs_object() { var dbContext = await InMemoryMockDbContext.GetDatabaseContext(); var jobs = dbContext.Jobs.ToList().First(); var leadResp = JobsMapper.ToLeadResponse(jobs); Assert.NotNull(leadResp); Assert.AreEqual(leadResp.Id, jobs.Id); Assert.AreEqual(leadResp.ContactName, jobs.ContactName); Assert.AreEqual(leadResp.CreatedDateTime, jobs.CreatedAt.DateTime); Assert.AreEqual(leadResp.Suburb, jobs.Suburb.Name); Assert.AreEqual(leadResp.CategoryName, jobs.Category.Name); Assert.AreEqual(leadResp.Description, jobs.Description); Assert.AreEqual(leadResp.Price, jobs.Price.ToString()); Assert.AreEqual(leadResp.Postcode, jobs.Suburb.Postcode); Assert.AreEqual(leadResp.Status, jobs.Status); }
public async Task Should_Update_The_Status_of_the_Lead_To_Declined() { var dbContext = await InMemoryMockDbContext.GetDatabaseContext(); var leadHandlerRepository = new LeadHandlerRepository(dbContext); var newLeads = await leadHandlerRepository.GetLeadsWithNewStatus(); var jobId = newLeads[0].Id; var response = await leadHandlerRepository.UpdateLeadStatus(jobId, LeadStatusType.Declined.ToString()); Assert.NotNull(response); Assert.AreEqual(LeadStatusType.Declined.ToString(), response.Status); var newLeadsAfterUpdate = await leadHandlerRepository.GetLeadsWithNewStatus(); Assert.NotNull(newLeadsAfterUpdate); Assert.AreEqual(newLeads.Count - 1, newLeadsAfterUpdate.Count); }
public async Task Should_Update_The_Status_of_the_Lead_To_Accepted() { var dbContext = await InMemoryMockDbContext.GetDatabaseContext(); var leadHandlerRepository = new LeadHandlerRepository(dbContext); var jobToBeUpdated = dbContext.Jobs.First(); var response = await leadHandlerRepository.UpdateLeadStatus(jobToBeUpdated.Id, LeadStatusType.Accepted.ToString()); Assert.NotNull(response); Assert.AreEqual(LeadStatusType.Accepted.ToString(), response.Status); var newLeads = await leadHandlerRepository.GetLeadsWithNewStatus(); Assert.NotNull(newLeads); Assert.AreEqual(4, newLeads.Count); var accLeads = await leadHandlerRepository.GetLeadsWithAcceptedStatus(); Assert.NotNull(accLeads); Assert.AreEqual(4, accLeads.Count); }