Esempio n. 1
0
        public UpgradeAsyncTests()
        {
            logger         = A.Fake <ILogger <MigrationRunner> >();
            container      = A.Fake <IRapidContainerAdapter>();
            environment    = A.Fake <IMigrationEnvironment>();
            appLocker      = A.Fake <IDistributedAppLockProvider>();
            contextFactory = A.Fake <IMigrationContextFactory>();
            finder         = A.Fake <IMigrationFinder>();
            storage        = A.Fake <IMigrationStorage>();
            context        = A.Fake <IMigrationContext>();
            appLock        = A.Fake <IDistributedAppLock>();
            migration1     = A.Fake <IMigration>();
            migration2     = A.Fake <IMigration>();

            A.CallTo(() => appLocker.AcquireAsync("RapidCoreMigrations", A <TimeSpan> ._, A <TimeSpan> ._))
            .Returns(Task.FromResult(appLock));
            A.CallTo(() => contextFactory.GetContext()).Returns(context);

            runner = new MigrationRunner(
                logger,
                container,
                environment,
                appLocker,
                contextFactory,
                finder,
                storage
                );
        }
Esempio n. 2
0
 public override MigrationSelector Create()
 {
     _migrationFinder     = _mocks.DynamicMock <IMigrationFinder>();
     _versionStateFactory = _mocks.DynamicMock <IVersionStateFactory>();
     _migrations          = new List <MigrationReference>();
     _migrations.Add(new MigrationReference(1, "A", "001_a.cs"));
     _migrations.Add(new MigrationReference(2, "B", "002_b.cs"));
     _migrations.Add(new MigrationReference(3, "C", "003_c.cs"));
     _migrations.Add(new MigrationReference(4, "D", "004_d.cs"));
     return(new MigrationSelector(_migrationFinder, _versionStateFactory));
 }
Esempio n. 3
0
 public MigrationRunner(
     ILogger <MigrationRunner> logger,
     IRapidContainerAdapter container,
     IMigrationEnvironment environment,
     IDistributedAppLockProvider appLocker,
     IMigrationContextFactory contextFactory,
     IMigrationFinder finder,
     IMigrationStorage storage
     )
 {
     this.logger         = logger;
     this.container      = container;
     this.environment    = environment;
     this.appLocker      = appLocker;
     this.contextFactory = contextFactory;
     this.finder         = finder;
     this.storage        = storage;
 }
Esempio n. 4
0
 public MigrationSelector(IMigrationFinder migrationFinder, IVersionStateFactory versionStateFactory)
 {
     _versionStateFactory = versionStateFactory;
       _migrationFinder = migrationFinder;
 }
Esempio n. 5
0
 public MigrationRunner(IExecutedMigrationsStorage storage, IMigrationFinder finder)
 {
     this.storage = storage ?? throw new ArgumentNullException(nameof(storage));
     this.finder  = finder ?? throw new ArgumentNullException(nameof(finder));
 }
 public MigrationSelector(IMigrationFinder migrationFinder, IVersionStateFactory versionStateFactory)
 {
     _versionStateFactory = versionStateFactory;
     _migrationFinder     = migrationFinder;
 }