コード例 #1
0
        public void SetUp()
        {
            Migration1.Reset();
            Migration2.Reset();

            this.connection = new Mock <DbConnection>()
            {
                DefaultValue = DefaultValue.Mock,
            };
            this.migrationProvider = new Mock <IMigrationProvider>();
            this.databaseProvider  = new Mock <MockDatabaseProvider>()
            {
                CallBase = true,
            };
            this.databaseProvider.Object.Connection = this.connection.Object;

            this.logger = new Mock <ILogger>();

            this.migrator = new SimpleMigrator <DbConnection, Migration>(this.migrationProvider.Object, this.databaseProvider.Object, this.logger.Object);

            this.migrations = new List <MigrationData>()
            {
                new MigrationData(1, "Migration 1", typeof(Migration1).GetTypeInfo()),
                new MigrationData(2, "Migration 2", typeof(Migration2).GetTypeInfo()),
            };
            this.migrationProvider.Setup(x => x.LoadMigrations()).Returns(this.migrations);
        }