コード例 #1
0
        private void VerifySchema(Migration migration, string?schema)
        {
            SchemaSetterMock.Verify(s => s.SetSchema(migration.UpOperations, schema), Times.Once);
            SchemaSetterMock.Verify(s => s.SetSchema(migration.DownOperations, schema), Times.Once);

            migration.UpOperations[0].Should().BeOfType <AddColumnOperation>().Subject.Schema.Should().Be(schema);
            migration.DownOperations[0].Should().BeOfType <DropColumnOperation>().Subject.Schema.Should().Be(schema);
        }
コード例 #2
0
        public void Should_not_set_schema_on_schema_unaware_migration_having_schema_unaware_ctx()
        {
            CurrentCtxMock.Setup(c => c.Context).Returns(CreateContextWithoutSchema());

            var migration = SUT.CreateMigration(typeof(MigrationWithoutSchema).GetTypeInfo(), "DummyProvider");

            SchemaSetterMock.Verify(s => s.SetSchema(It.IsAny <IReadOnlyList <MigrationOperation> >(), It.IsAny <string>()), Times.Never);
            migration.UpOperations[0].Should().BeOfType <AddColumnOperation>().Subject.Schema.Should().BeNull();
            migration.DownOperations[0].Should().BeOfType <DropColumnOperation>().Subject.Schema.Should().BeNull();
        }