Ejemplo n.º 1
0
        public void CanFindMigrationsInNamespace()
        {
            var conventions = new MigrationConventions();
            var asm         = Assembly.GetExecutingAssembly();
            var loader      = new MigrationLoader(conventions, asm, "FluentMigrator.Tests.Integration.Migrations.Interleaved.Pass1", null);

            var migrationList = loader.FindMigrations();

            migrationList.Select(x => x.Type).ShouldNotContain(typeof(VersionedMigration));
            migrationList.Count().ShouldBeGreaterThan(0);
        }
Ejemplo n.º 2
0
        public void DoesNotFindsMigrationsInNestedNamepsaceWhenLoadNestedNamespacesDisabled()
        {
            var conventions = new MigrationConventions();
            var asm         = Assembly.GetExecutingAssembly();
            var loader      = new MigrationLoader(conventions, asm, "FluentMigrator.Tests.Integration.Migrations.Nested", false);

            List <Type> expected = new List <Type>
            {
                typeof(Integration.Migrations.Nested.NotGrouped),
            };

            var         migrationList = loader.FindMigrations();
            List <Type> actual        = migrationList.Select(m => m.Type).ToList();

            CollectionAssert.AreEquivalent(expected, actual);
        }
Ejemplo n.º 3
0
        public void DoesNotFindMigrationsThatDoNotHaveMatchingTags()
        {
            var asm           = Assembly.GetExecutingAssembly();
            var migrationType = typeof(TaggedMigraion);
            var tagsToMatch   = new[] { "UK", "Production" };

            var conventionsMock = new Mock <IMigrationConventions>();

            conventionsMock.SetupGet(m => m.GetMetadataForMigration).Returns(DefaultMigrationConventions.GetMetadataForMigration);
            conventionsMock.SetupGet(m => m.TypeIsMigration).Returns(t => true);
            conventionsMock.SetupGet(m => m.TypeHasTags).Returns(t => migrationType == t);
            conventionsMock.SetupGet(m => m.TypeHasMatchingTags).Returns((type, tags) => false);

            var loader = new MigrationLoader(conventionsMock.Object, asm, migrationType.Namespace, tagsToMatch);

            var expected = new List <Type> {
                typeof(UntaggedMigration)
            };

            var actual = loader.FindMigrations().Select(m => m.Type).ToList();

            CollectionAssert.AreEquivalent(expected, actual);
        }