Example #1
0
    //protected FakeS3Client s3Mock;



    public FileServiceTests(DbUnitTestSearchFixture fixture)
    {
        this.fixture = fixture;
        this.mapper  = fixture.GetService <IMapper>();

        //This client throws exceptions for everything
        //s3Mock = new FakeS3Client();
        s3provider = new S3Provider(); //As is, it will returned NotImplemented for IAmazonS3

        searcher = fixture.GetGenericSearcher();
        writer   = fixture.GetWriter();
        config   = new FileServiceConfig()
        {
            HighQualityResize = false
        };
        service = new FileService(fixture.GetService <ILogger <FileService> >(), fixture.dbFactory, config, s3provider,
                                  new ImageManipulator_Direct(fixture.GetService <ILogger <ImageManipulator_Direct> >()));

        //Always want a fresh database!
        fixture.ResetDatabase();

        //Every test gets their own directory
        config.MainLocation      = Guid.NewGuid().ToString() + "_main";
        config.ThumbnailLocation = Guid.NewGuid().ToString() + "_thumbnails";
        config.TempLocation      = Guid.NewGuid().ToString() + "_temp(quant)";
    }
 public LiveExtensionsTest(DbUnitTestSearchFixture fixture)
 {
     this.fixture = fixture;
     userStatuses = GetService <IUserStatusTracker>(); //DON'T use the fixture! want NEW service every time!
     searcher     = fixture.GetGenericSearcher();
     fixture.ResetDatabase();
 }
    //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 ShortcutsServiceTests(DbUnitTestSearchFixture fixture)
 {
     this.fixture = fixture;
     this.writer  = fixture.GetWriter();
     this.search  = fixture.GetGenericSearcher();
     this.mapper  = fixture.GetService <IMapper>();
     this.service = new ShortcutsService(fixture.GetService <ILogger <ShortcutsService> >(), fixture.dbFactory, mapper);
 }
    public SpecializedSearchTests(DbUnitTestSearchFixture fixture)
    {
        this.fixture = fixture;
        this.mapper  = fixture.GetService <IMapper>();

        searcher = fixture.GetGenericSearcher(); //GetService<IGenericSearch>();
        writer   = fixture.GetWriter();

        //Always want a fresh database!
        fixture.ResetDatabase();
    }
    public CombinedUserTests(DbUnitTestSearchFixture fixture)
    {
        this.fixture = fixture;
        this.mapper  = fixture.GetService <IMapper>();

        searcher = fixture.GetGenericSearcher();
        writer   = fixture.GetWriter();

        service = fixture.GetService <IUserService>();

        //Always want a fresh database!
        fixture.ResetDatabase();
    }
    public ModuleServiceTests(DbUnitTestSearchFixture fixture)
    {
        this.fixture  = fixture;
        this.writer   = fixture.GetWriter();
        this.searcher = fixture.GetGenericSearcher();

        config = new ModuleServiceConfig()
        {
            ModuleDataConnectionString = "Data Source=moduledata;Mode=Memory;Cache=Shared"
        };

        service          = new ModuleService(config, fixture.GetService <ILogger <ModuleService> >(), fixture.dbFactory);
        masterconnection = new SqliteConnection(config.ModuleDataConnectionString);
        masterconnection.Open();

        fixture.ResetDatabase();
    }