//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 MarkManager(IDbWriter <Mark> dbWriter, IDbReader <Mark> dbReader, UserManager <DailerUser> userManager, IHttpContextAccessor httpContextAccessor) { _dbReader = dbReader; _dbWriter = dbWriter; _userMananager = userManager; _httpContextAccessor = httpContextAccessor; }
public NoteManager(UserManager <DailerUser> userManager, IHttpContextHendler httpContextHendler, IDbReader <Note> dbReader, IDbWriter <Note> dbWriter) { _userManager = userManager; _httpContextHendler = httpContextHendler; _dbReader = dbReader; _dbWriter = dbWriter; }
public static void Initialize(IDbWriter db) { var dbConnection = db.Connection; dbConnection.Open(); dbConnection.Execute("PRAGMA read_uncommitted = true;"); var migrator = DeployChanges.To .SQLiteDatabase(db.Connection.ConnectionString) .WithScriptsAndCodeEmbeddedInAssembly(typeof(Patch1).Assembly, s => s.StartsWith("Zoxive.HttpLoadTesting.Client.Domain.Database.Migrations")) .WithTransaction() .LogToConsole() .Build(); var wasPatched = migrator.IsUpgradeRequired(); var result = migrator.PerformUpgrade(); if (result.Successful && wasPatched) { db.Connection.Execute("VACUUM"); } if (!result.Successful) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(result.Error); Console.ResetColor(); throw new Exception("Migration Failed"); } }
/// <summary> /// Initializes a new instance of the <see cref="DbImporter"/> class. /// </summary> /// <param name="dbWriter">The database writer - an object which implements <see cref="IDbWriter"/> interface.</param> /// <param name="datasetImporter">The dataset importer - knows how to read one dataset data stored in a particular format.</param> /// <param name="unpacker">The unpacker - knows how to find the data for a particular dataset "packed" in "archive".</param> /// <param name="loggerFactory">The logger factory.</param> public DbImporter(IDbWriter dbWriter, IDatasetImporter datasetImporter, IDataUnpacker unpacker, ILoggerFactory loggerFactory = null) { _dbWriter = dbWriter; _datasetImporter = datasetImporter; _dataUnpacker = unpacker; _logger = loggerFactory?.CreateLogger("Korzh.DbUtils"); }
public DatabaseProvider(IThronesDBProvider thronesDbProvider, IDbReader localDbReader, IDbWriter localDbWriter) { this.thronesDbProvider = thronesDbProvider; this.localDbReader = localDbReader; this.localDbWriter = localDbWriter; }
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 FileWorker(DataBase dataBase, IDbWriterFactory dbWriterFactory, ISourceFactory sourceFactory) { _sourceFactory = sourceFactory; DataBase = dataBase; _dbWriter = dbWriterFactory.GetDbWriter(dataBase.Settings.DefaultSource); }
public void Initialize() { var dbClientFactoryMock = new Mock <IDbClientFactory>(); _dbClientMock = new Mock <IDbClient>(); dbClientFactoryMock.Setup(x => x.GetMongoClient(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())).Returns(_dbClientMock.Object); _dbWriter = new MongoDbWriter(dbClientFactoryMock.Object); }
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(); }
// TODO would be nice to have a dotnetcore compatible migrator. public static void Initialize(IDbWriter db, string @namespace = "main") { var dbConnection = db.Connection; dbConnection.Open(); dbConnection.Execute("PRAGMA read_uncommitted = true;"); if (IterationTableExists(dbConnection, @namespace)) { return; } dbConnection.Execute($"DROP TABLE IF EXISTS {@namespace}.Iteration;"); dbConnection.Execute($"DROP TABLE IF EXISTS {@namespace}.HttpStatusResult;"); dbConnection.Execute($@" CREATE TABLE {@namespace}.Iteration ( Id INTEGER PRIMARY KEY AUTOINCREMENT, UserNumber INTEGER, Iteration INTEGER, StartTick BIGINT, EndTick BIGINT, UserDelay BIGINT, Exception VARCHAR, DidError BOOLEAN, BaseUrl VARCHAR, Elapsed BIGINT, TestName VARCHAR ); "); dbConnection.Execute($@" CREATE TABLE {@namespace}.HttpStatusResult ( Id INTEGER PRIMARY KEY, IterationId INTEGER, Method VARCHAR, ElapsedMilliseconds REAL, RequestUrl VARCHAR, StatusCode INTEGER, RequestStartTick BIGINT ); "); }
public DeleteModel(IDbWriter writer, IDbReader reader, IUserInfoService db) { _writer = writer; _reader = reader; _db = db; }
public CreateModel(IDbWriter writer, IDbReader reader) { _writer = writer; _reader = reader; }
public static IterationResultRepository CreateIterationResultRepository(string databaseFile, out IDbWriter fileDb) { var connection = new SqliteConnection($"Data Source={databaseFile};cache=shared"); fileDb = new Db(connection); var fileResultRepository = new IterationResultRepository(fileDb); DbInitializer.Initialize(fileDb); // Looks like we dont really need this //connection.Execute("PRAGMA synchronous = OFF;"); connection.Execute("PRAGMA journal_mode = MEMORY;"); return(fileResultRepository); }
public SimpleTransaction(IDbWriter dbConnection) { _dbConnection = (DbConnection)dbConnection.Connection; }
public TraitService(IDbWriter <Trait> dbWriter, IDbReader <Trait> dbReader) { _dbWriter = dbWriter; _dbReader = dbReader; }
public CreateModel(IDbWriter db) { _db = db; }
public IterationResultRepository(IDbWriter dbConnection) { _dbConnection = (DbConnection)dbConnection.Connection; }
public EditModel(IDbReader reader, IDbWriter writer) { _reader = reader; _writer = writer; }