//methods public override void SpecInit(INeedSampleDatabase instance) { instance.SampleDatabase = new SampleDbContext(); AutoMockedContainer container = instance.Mocker.GetContainer(); container.Configure(cfg => { cfg.For <SampleDbContext>().Use(instance.SampleDatabase); cfg.For <DbContext>().Use(instance.SampleDatabase); }); }
//methods public override void SpecInit(INeedDbContext instance) { dynamic specsDynamic = instance; AutoMockedContainer autoMockContainer = specsDynamic.Mocker.MoqAutoMocker.Container; string connectionString = @"Data Source=.\;Initial Catalog=SanatanaNotificationsSpecs;integrated security=true;MultipleActiveResultSets=True;"; var connection = new SqlConnectionSettings { ConnectionString = connectionString, Schema = "dbo" }; autoMockContainer.Configure(cfg => { cfg.For <SqlConnectionSettings>().Use(connection); cfg.For <ISenderDbContextFactory>().Use <SenderDbContextFactory>(); cfg.For <INotificationsMapperFactory>().Use <NotificationsMapperFactory>(); cfg.For <IDispatchTemplateQueries <long> >().Use <SqlDispatchTemplateQueries>(); cfg.For <SqlDispatchTemplateQueries>().Use <SqlDispatchTemplateQueries>(); cfg.For <SqlEventSettingsQueries>().Use <SqlEventSettingsQueries>(); cfg.For <SqlSignalBounceQueries>().Use <SqlSignalBounceQueries>(); cfg.For <SqlSignalDispatchQueries>().Use <SqlSignalDispatchQueries>(); cfg.For <SqlSignalEventQueries>().Use <SqlSignalEventQueries>(); cfg.For <SqlStoredNotificationQueries>().Use <SqlStoredNotificationQueries>(); cfg.For <SqlSubscriberCategorySettingsQueries>().Use <SqlSubscriberCategorySettingsQueries>(); cfg.For <SqlSubscriberDeliveryTypeSettingsQueries>().Use <SqlSubscriberDeliveryTypeSettingsQueries>(); cfg.For <SqlSubscriberQueries>().Use <SqlSubscriberQueries>(); cfg.For <SqlSubscriberScheduleSettingsQueries>().Use <SqlSubscriberScheduleSettingsQueries>(); cfg.For <SqlSubscriberTopicSettingsQueries>().Use <SqlSubscriberTopicSettingsQueries>(); }); ISenderDbContextFactory factory = autoMockContainer.GetInstance <ISenderDbContextFactory>(); instance.DbContext = factory.GetDbContext(); instance.DbContext.ChangeTracker.QueryTrackingBehavior = Microsoft.EntityFrameworkCore.QueryTrackingBehavior.NoTracking; }
//methods public override void SpecInit(ISpecs instance) { if (!_serializerConfigured) { SpecsDbContext.ApplyGlobalSerializationSettings(); _serializerConfigured = true; } var connection = new MongoDbConnectionSettings { DatabaseName = "NotificationsSpecs", Host = "localhost", Port = 27017 }; AutoMockedContainer autoMockContainer = instance.Mocker.GetContainer(); autoMockContainer.Configure(cfg => { cfg.For <MongoDbConnectionSettings>().Use(connection); cfg.For <SpecsDbContext>().Use <SpecsDbContext>(); cfg.For <ICollectionFactory>().Use <SpecsDbContext>(); }); }