public MigrationTaskRunnerTests() { _db = new Mock<IAccessDb>(); _db.Setup(d => d.BeginTransaction(null)).Returns(new FakeTransaction()); LogHelper.Register(new ConsoleLogger(), "Default"); _sb = new StringBuilder(); _runner = new MigrationTaskRunner(_db.Object, LogHelper.DefaultLogger); }
public IManageMigrations Build() { if (_resolver == null) { throw new InvalidOperationException("Missing dependency resolver"); } var types = _asm .SelectMany(a => AssemblyExtensions.GetTypesImplementing <IMigrationTask>(a, true) .Select(t => (IMigrationTask)_resolver.Resolve(t))) .Where(t => t.CurrentVersion != null) .ToArray(); if (types.Length == 0) { throw new MigrationNotFoundException("None of the provided assemblies contained SqlFu migrations"); } var runner = new MigrationTaskRunner(_db, _log); return(new MigrationsManager(GetSchemaExecutors(types, runner), runner)); }