Exemple #1
0
            public void WhenRunningTheApplyProcess()
            {
                _outputWriter = new OutputWriterSpy();

                var allMigrations = new List <MigrationData>
                {
                    new MigrationData(1, "first", typeof(MigrationData).GetTypeInfo()),
                    new MigrationData(2, "second (current)", typeof(MigrationData).GetTypeInfo()),
                    new MigrationData(3, "third", typeof(MigrationData).GetTypeInfo()),
                    new MigrationData(4, "fourth", typeof(MigrationData).GetTypeInfo()),
                    new MigrationData(5, "fifth", typeof(MigrationData).GetTypeInfo()),
                };

                _migrator = new Mock <ISimpleMigrator>();
                _migrator.SetupGet(m => m.CurrentMigration).Returns(allMigrations[1]);
                _migrator.SetupGet(m => m.Migrations).Returns(allMigrations);

                _migrationsPerformed = new List <long>();
                _migrator
                .Setup(m => m.MigrateTo(It.IsAny <long>()))
                .Callback((long version) => _migrationsPerformed.Add(version));

                var applyProcess = new ApplyProcess(_outputWriter);

                applyProcess.Run(_migrator.Object, 4);
            }
        public void GivenThreeMigrationsAndCurrentlyOnVersionTwo()
        {
            _outputWriter = new OutputWriterSpy();

            var allMigrations = new List <MigrationData>
            {
                new MigrationData(1, "first", typeof(MigrationData).GetTypeInfo()),
                new MigrationData(2, "second (current)", typeof(MigrationData).GetTypeInfo()),
                new MigrationData(3, "third", typeof(MigrationData).GetTypeInfo()),
            };

            _migrator = new Mock <ISimpleMigrator>();
            _migrator.SetupGet(m => m.CurrentMigration).Returns(allMigrations[1]);
            _migrator.SetupGet(m => m.LatestMigration).Returns(allMigrations[2]);
            _migrator.SetupGet(m => m.Migrations).Returns(allMigrations);

            _versionValidator = new VersionValidator(_outputWriter);
        }
Exemple #3
0
            public void SetUp()
            {
                _outputWriter = new OutputWriterSpy();

                var allMigrations = new List <MigrationData>
                {
                    new MigrationData(1, "first", typeof(MigrationData).GetTypeInfo()),
                    new MigrationData(2, "second", typeof(MigrationData).GetTypeInfo()),
                    new MigrationData(3, "third (current)", typeof(MigrationData).GetTypeInfo()),
                    new MigrationData(4, "fourth", typeof(MigrationData).GetTypeInfo()),
                };

                _migrator = new Mock <ISimpleMigrator>();
                _migrator.SetupGet(m => m.CurrentMigration).Returns(allMigrations[2]);
                _migrator.SetupGet(m => m.Migrations).Returns(allMigrations);

                new NoOpProcess(_outputWriter).Run(_migrator.Object, 1);
            }