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
        protected virtual IMigrationContext GetContext()
        {
            var ctx = contextFactory.GetContext();

            ctx.Logger      = logger;
            ctx.Environment = environment;
            ctx.Container   = container;
            ctx.Storage     = storage;

            return(ctx);
        }