public void SendJobOffers() { var customers = customerService.FindAll(); var jobOffers = jobOffersService.FindAll(); CreateEmailMessage(jobOffers); foreach (var customer in customers) { emailService.Send(customer.EMail, subject, this.Message); } }
public void FindAll() { var contactPerson = new ContactPerson { Id = 1, Name = "cp", PhoneNumber = "", EMail = "" }; var jobOffers = new List <JobOffer> { new JobOffer { Id = 1, ContactPerson = contactPerson, Description = "job1", ExpirationDate = new DateTime(), IssuedDate = new DateTime() }, new JobOffer { Id = 2, ContactPerson = contactPerson, Description = "job2", ExpirationDate = new DateTime(), IssuedDate = new DateTime() }, }; jobOfferRepositoryMock.Setup(m => m.FindAll()).Returns(jobOffers.AsQueryable()); var result = jobOffersService.FindAll(); Assert.IsNotNull(result); Assert.AreEqual(2, result.Count()); Assert.IsTrue(result.First().Description.Equals("job1")); Assert.IsTrue(result.Last().Description.Equals("job2")); }