public void ResourceFinderFindThrowsExceptionIfFoundMoreThenOneResource() { var expression = new ExecuteEmbeddedSqlScriptExpression { SqlScript = "NotUniqueResource.sql", MigrationAssembly = Assembly.GetExecutingAssembly() }; var processor = new Mock<IMigrationProcessor>(); Assert.Throws<InvalidOperationException>(() => expression.ExecuteWith(processor.Object)); processor.Verify(x => x.Execute("NotUniqueResource"), Times.Never()); }
public void ResourceFinderIsCaseInsensitive() { var expression = new ExecuteEmbeddedSqlScriptExpression { SqlScript = testSqlScript.ToUpper(), MigrationAssembly = Assembly.GetExecutingAssembly() }; var processor = new Mock<IMigrationProcessor>(); processor.Setup(x => x.Execute(scriptContents)).Verifiable(); expression.ExecuteWith(processor.Object); processor.Verify(); }
public void ResourceFinderFindFileWithFullNameAndNamespace() { var expression = new ExecuteEmbeddedSqlScriptExpression { SqlScript = "FluentMigrator.Tests.EmbeddedResources.InitialSchema.sql", MigrationAssembly = Assembly.GetExecutingAssembly() }; var processor = new Mock<IMigrationProcessor>(); processor.Setup(x => x.Execute("InitialSchema")).Verifiable(); expression.ExecuteWith(processor.Object); processor.Verify(); }
public void ExecutesTheStatement() { var expression = new ExecuteEmbeddedSqlScriptExpression { SqlScript = testSqlScript, MigrationAssembly = Assembly.GetExecutingAssembly() }; var processor = new Mock<IMigrationProcessor>(); processor.Setup(x => x.Execute(scriptContents)).Verifiable(); expression.ExecuteWith(processor.Object); processor.Verify(); }
public void CanExecuteEmbeddedResource() { Mock<IMigrationProcessor> mockProcessor = new Mock<IMigrationProcessor>(); ExecuteEmbeddedSqlScriptExpression expression = new ExecuteEmbeddedSqlScriptExpression { MigrationAssembly = Assembly.GetExecutingAssembly(), SqlScript = "EmbeddedScript.txt" }; expression.ExecuteWith(mockProcessor.Object); mockProcessor.Verify(mock => mock.Execute("TEST SQL")); }