private static void CreateTestEmailCargo(DealsContract dealsContract, Tuple <string, string> tuple) { Log.Verbose("Creating test email cargo"); List <Guid> dealGuids = null; if (dealsContract.Deals != null && dealsContract.Deals.Any()) { dealGuids = dealsContract.Deals.Select(dealId => new Guid(dealId)).ToList(); } User user = _usersDal.GetUserByUserId(new Guid(_testUserId)); if (!dealsContract.Location.StartsWith("us:postal:")) { dealsContract.Location = string.Format("{0}:{1}", "us:postal", dealsContract.Location); } foreach (string email in _lstTestEmailAddress) { DealsEmailCargo dealsEmailCargo = new DealsEmailCargo { Id = user.Id, UserId = user.Id, EmailAddress = email, Campaign = tuple.Item2, Hints = new EmailJobHints { IsTest = false, IncludeDeals = true, IsTestEmail = true }, LocationId = dealsContract.Location, UnsubscribeUrl = _usersDal.GetUnsubscribeUrlInfo(user.Id).UnsubscribeUrl, DealIds = dealGuids, IsCloDeal = true, Subject = dealsContract.Subject }; dealsEmailCargo.EmailRenderingServiceAddress = string.Format(tuple.Item1, dealsEmailCargo.Campaign); _emailJobsQueue.Enqueue(dealsEmailCargo); Log.Verbose("Enqueued Deals test email cargo : {0} ", dealsEmailCargo.ToString()); } }