private static void AddFlatOfferToDb(INotificationSetup setup, Func <FlatOffer, IEnumerable <Notification> > getNotifications) { var offer = FlatOfferFactory.GetFlatOfferType1(); offer.Notifications.AddRange(getNotifications(offer)); setup.DbContext.FlatOffers.Add(offer); setup.DbContext.SaveChanges(); setup.FlatOfferIds.Add(offer.Id.Value); }
public UpdateAndRemoveAtSameTimeTestFixture(FlatOffersDbContextFixture dbFixture) { var connectionString = dbFixture.Context.Database.GetDbConnection().ConnectionString; var checkpoint = new Checkpoint(); Task.Run(() => checkpoint.Reset(connectionString)).Wait(); var Offer = FlatOfferFactory.GetFlatOfferType1(); var Ad1 = AdvertisementFactory.GetAdverstisementType1(); var Ad2 = AdvertisementFactory.GetAdvertisementBasedOnOffer(Offer); Ad2.Price = UpdatedPrice; PopulateTables(dbFixture, Offer); var collector = new TestCollectorStub(); collector.Add(Ad1); collector.Add(Ad2); var underTest = TrackOfferHandlerFactory.GetInstance(dbFixture.Context, collector); underTest.Execute(); }