示例#1
0
        public void Generate_SqlFileOperation_produce_sql_file_statements()
        {
            var operation = new SqlFileOperation(@".\fixtures\SqlFileOperation.sql");

            var sqlGenerator = new ExtendedSqlServerMigrationSqlGenerator();

            var sql = sqlGenerator.Generate(new MigrationOperation[] { operation }, "2008").Join(ss => ss.Sql, Environment.NewLine);

            Assert.Contains("--drop database", sql);
        }
        /// <summary>
        /// Generate a sql from existing sql file
        /// </summary>
        /// <param name="sqlFileOperation">the operation to produce sql for.</param>
        public virtual void Generate(SqlFileOperation sqlFileOperation)
        {
            using (var writer = Writer())
            {
                using (var stream = sqlFileOperation.SqlFileStream)
                    using (var reader = new StreamReader(stream))
                    {
                        writer.Write(reader.ReadToEnd());

                        this.Statement(writer);
                    }
            }
        }
        public void Can_get_properties()
        {
            var operation = new SqlFileOperation(@".\fixtures\SqlFileOperation.sql");

            Assert.NotNull(operation.SqlFileStream);
        }