Пример #1
0
    //The tests here are rather complicated; we can probably simplify them in the future, but for now,
    //I just need a system that REALLY tests if this whole thing works, and that is most reliable if
    //I just use the (known to work) dbwriter to set up the database in a way we expect.
    public EventQueueTest(DbUnitTestSearchFixture fixture)
    {
        this.fixture    = fixture;
        this.searcher   = fixture.GetGenericSearcher();
        this.mapper     = fixture.GetService <IMapper>();
        this.permission = fixture.GetService <IPermissionService>();
        this.shortcuts  = fixture.GetService <ShortcutsService>();

        this.config = new LiveEventQueueConfig()
        {
            //Ensure nothing ever expires
            DataCacheExpire = System.TimeSpan.MaxValue
        };
        this.trackerConfig = new CacheCheckpointTrackerConfig()
        {
            CacheCleanFrequency = int.MaxValue
        };
        //Note: WE HAVE TO create a new tracker every time! We don't want old data clogging this up!!
        this.tracker = new CacheCheckpointTracker <LiveEvent>(fixture.GetService <ILogger <CacheCheckpointTracker <LiveEvent> > >(), trackerConfig);
        this.queue   = new LiveEventQueue(fixture.GetService <ILogger <LiveEventQueue> >(), this.config, this.tracker, fixture.dbFactory, this.permission, this.mapper);
        writer       = new DbWriter(fixture.GetService <ILogger <DbWriter> >(), this.searcher,
                                    fixture.GetConnection(), fixture.GetService <IViewTypeInfoService>(), this.mapper,
                                    fixture.GetService <History.IHistoryConverter>(), this.permission, this.queue,
                                    new DbWriterConfig(), new RandomGenerator(), fixture.GetService <IUserService>());


        //Reset it for every test
        fixture.ResetDatabase();
    }
 public CacheCheckpointTrackerTest()
 {
     config     = new CacheCheckpointTrackerConfig();
     tracker    = new CacheCheckpointTracker <int>(GetService <ILogger <CacheCheckpointTracker <int> > >(), config);
     trackerIds = new CacheCheckpointTracker <SimpleLinkedCheckpointId>(GetService <ILogger <CacheCheckpointTracker <SimpleLinkedCheckpointId> > >(), config);
 }
Пример #3
0
 public CacheCheckpointTracker(ILogger <CacheCheckpointTracker <T> > logger, CacheCheckpointTrackerConfig config)
 {
     this.logger = logger;
     this.config = config;
 }