コード例 #1
0
        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());
        }
コード例 #2
0
        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();
        }
コード例 #3
0
        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();
        }
コード例 #4
0
        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();
        }
コード例 #5
0
        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"));
        }