Example #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
                );
        }
Example #2
0
        public ReflectionMigrationFinderTests()
        {
            context   = A.Fake <IMigrationContext>();
            container = A.Fake <IRapidContainerAdapter>();
            storage   = A.Fake <IMigrationStorage>();

            A.CallTo(() => context.Container).Returns(container);
            A.CallTo(() => context.Storage).Returns(storage);

            A.CallTo(() => container.Resolve(A <Type> ._)).Returns(null);

            finder = new ReflectionMigrationFinder(typeof(ReflectionMigrationFinderTests).GetTypeInfo().Assembly);
        }
Example #3
0
        public MigrationBaseTest()
        {
            context = A.Fake <IMigrationContext>();
            storage = A.Fake <IMigrationStorage>();
            info    = A.Fake <MigrationInfo>();

            A.CallTo(() => context.Storage).Returns(storage);

            migration = new ImplMigrationBase
            {
                ConfigureUpgradeAction   = A.Fake <Action <IMigrationBuilder> >(),
                ConfigureDowngradeAction = A.Fake <Action <IMigrationBuilder> >()
            };
        }
Example #4
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;
 }
Example #5
0
 public SuperGlueMigrator(IMigrationStorage storage, IDictionary <string, object> environment) : base(storage)
 {
     _environment = environment;
 }