private static void VerifyWhiteDeliveryDiscrepancies(IDiscrepanciesService service, Mapping provider, int daysCreated) { var result = service.GetNotEngagedMailableItemsAsync(provider.ProviderId, provider.SubscriberId, daysCreated).Result; // Assert if (result.Any()) { result.Take(MaxAccountsToVerify).ToList().ForEach(x => { if (x.Account.HasValue) { using (var ctx = new EngagerContext()) { var id = x.Account.Value.AccountId; var account = ctx.Accounts.FirstOrDefault(acc => acc.AccountId == id); Assert.IsNotNull(account); Assert.IsFalse(account.IsActive); } Assert.AreEqual(x.Description, SeedDiscrepancy.NotMailableSeedMessage); } else { using (var ctx = new EngagerContext()) { var oldestDateCreated = DateTime.Today.AddDays(-daysCreated); var account = ctx.Accounts.FirstOrDefault(acc => (acc.DateAccountCreated >= oldestDateCreated) && (acc.EmailAddress == x.EmailAddress)); Assert.IsNull(account); } Assert.AreEqual(x.Description, string.Format(SeedDiscrepancy.MissingSeedMessage, "Engager")); } }); } }
private static void VerifyEngagerDiscrepancies(IDiscrepanciesService service, Mapping provider, int daysCreated) { var result = service.GetNotMailableEngagedItemsAsync(provider.ProviderId, provider.SubscriberId, daysCreated).Result; // Assert if (result.Any()) { result.Take(MaxAccountsToVerify).ToList().ForEach(x => { if (x.Subscriber.HasValue) { using (var ctx = new SubscribersContext()) { var metadata = service.GetMetadataForProviderAsync(provider.SubscriberId).Result; var subscriber = ctx.FromStore(metadata.DatabaseName, metadata.TableName).GetSubscribers(s => s.subscriber_id == x.Subscriber.Value.SubscriberId).Result.SingleOrDefault(); Assert.IsNotNull(subscriber); Assert.AreEqual(subscriber.send, 0); } Assert.AreEqual(x.Description, SeedDiscrepancy.NotMailableSeedMessage); } else { using (var ctx = new SubscribersContext()) { var metadata = service.GetMetadataForProviderAsync(provider.SubscriberId).Result; var subscriber = ctx.FromStore(metadata.DatabaseName, metadata.TableName).GetSubscribers(s => s.email == x.EmailAddress).Result.SingleOrDefault(); Assert.IsNull(subscriber); } Assert.AreEqual(x.Description, string.Format(SeedDiscrepancy.MissingSeedMessage, "WD")); } }); } }