text:
<!DOCTYPE html>

  <title>fraction.js</title>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <link rel="stylesheet" media="all" href="public/stylesheets/normalize.css" />
  <link rel="stylesheet" media="all" href="docco.css" />

fraction.js

Table of Contents

                    accidental.js

                    annotation.js

                    articulation.js

                    barnote.js

                    beam.js

                    bend.js

                    boundingbox.js

                    canvascontext.js

                    clef.js

                    clefnote.js

                    crescendo.js

                    curve.js

                    dot.js

                    flow.js

                    vexflow_font.js

                    formatter.js

                    fraction.js

                    frethandfinger.js

                    ghostnote.js

                    glyph.js

                    gracenote.js

                    gracenotegroup.js

                    keymanager.js

                    keysignature.js

                    modifier.js

                    modifiercontext.js

                    music.js

                    note.js

                    notehead.js

                    ornament.js

                    pedalmarking.js

                    raphaelcontext.js

                    renderer.js

                    stave.js

                    stavebarline.js

                    staveconnector.js

                    stavehairpin.js

                    staveline.js

                    stavemodifier.js

                    stavenote.js

                    staverepetition.js

                    stavesection.js

                    stavetempo.js

                    stavetext.js

                    stavetie.js

                    stavevolta.js

                    stem.js

                    stemmablenote.js

                    stringnumber.js

                    strokes.js

                    svgcontext.js

                    tables.js

                    tabnote.js

                    tabslide.js

                    tabstave.js

                    tabtie.js

                    textbracket.js

                    textdynamics.js

                    textnote.js

                    tickable.js

                    tickcontext.js

                    timesignature.js

                    timesignote.js

                    tremolo.js

                    tuning.js

                    tuplet.js

                    vex.js

                    vibrato.js

                    voice.js

                    voicegroup.js

Fraction class that represents a rational number
@author zz85
@author incompleteopus (modifications)

Vex.Flow.Fraction = (function() {
  function Fraction(numerator, denominator) {
    this.set(numerator, denominator);
  }

  /**
   * GCD: Find greatest common divisor using Euclidean algorithm
   */
  Fraction.GCD = function(a, b) {
    if (typeof a !== "number" || typeof b !== "number") {
      throw new Vex.RERR("BadArgument", "Invalid numbers: " + a + ", " + b);
    }

    var t;

    while (b !== 0) {
      t = b;
      b = a % b;
      a = t;
    }

    return a;
  };

  /**
   * LCM: Lowest common multiple
   */
  Fraction.LCM = function(a, b) {
    return ((a * b) / Fraction.GCD(a, b));
  };

  /**
   * LCMM: Lowest common multiple for more than two numbers
   */
  Fraction.LCMM = function(args) {
    if (args.length === 0) {
      return 0;
    } else if (args.length == 1) {
      return args[0];
    } else if (args.length == 2) {
      return Vex.Flow.Fraction.LCM(args[0], args[1]);
    } else {
      var arg0 = args[0];
      args.shift();
      return Fraction.LCM(arg0, Vex.Flow.Fraction.LCMM(args));
    }
  };

  Fraction.prototype = {
    set: function(numerator, denominator) {
      this.numerator = numerator === undefined ? 1 : numerator;
      this.denominator = denominator === undefined ? 1 : denominator;
      return this;
    },

    value: function() {
      return this.numerator / this.denominator;
    },

    simplify: function() {
      var u = this.numerator;
      var d = this.denominator;

      var gcd = Vex.Flow.Fraction.GCD(u, d);
      u /= gcd;
      d /= gcd;

      if (d < 0) {
        d = -d;
        u = -u;
      }
      return this.set(u, d);
    },

    add: function(param1, param2) {
      var otherNumerator;
      var otherDenominator;

      if (param1 instanceof Vex.Flow.Fraction) {
        otherNumerator = param1.numerator;
        otherDenominator = param1.denominator;
      } else {
        if (param1 !== undefined) {
          otherNumerator = param1;
        } else {
          otherNumerator = 0;
        }

        if (param2 !== undefined) {
          otherDenominator = param2;
        } else {
          otherDenominator = 1;
        }
      }

      var lcm = Vex.Flow.Fraction.LCM(this.denominator, otherDenominator);
      var a = lcm / this.denominator;
      var b = lcm / otherDenominator;

      var u = this.numerator * a + otherNumerator * b;
      return this.set(u, lcm);
    },

    subtract: function(param1, param2) {
      var otherNumerator;
      var otherDenominator;

      if (param1 instanceof Vex.Flow.Fraction) {
        otherNumerator = param1.numerator;
        otherDenominator = param1.denominator;
      } else {
        if (param1 !== undefined) {
          otherNumerator = param1;
        } else {
          otherNumerator = 0;
        }

        if (param2 !== undefined) {
          otherDenominator = param2;
        } else {
          otherDenominator = 1;
        }
      }

      var lcm = Vex.Flow.Fraction.LCM(this.denominator, otherDenominator);
      var a = lcm / this.denominator;
      var b = lcm / otherDenominator;

      var u = this.numerator * a - otherNumerator * b;
      return this.set(u, lcm);
    },

    multiply: function(param1, param2) {
      var otherNumerator;
      var otherDenominator;

      if (param1 instanceof Vex.Flow.Fraction) {
        otherNumerator = param1.numerator;
        otherDenominator = param1.denominator;
      } else {
        if (param1 !== undefined) {
          otherNumerator = param1;
        } else {
          otherNumerator = 1;
        }

        if (param2 !== undefined) {
          otherDenominator = param2;
        } else {
          otherDenominator = 1;
        }
      }

      return this.set(this.numerator * otherNumerator, this.denominator * otherDenominator);
    },

    divide: function(param1, param2) {
      var otherNumerator;
      var otherDenominator;

      if (param1 instanceof Vex.Flow.Fraction) {
        otherNumerator = param1.numerator;
        otherDenominator = param1.denominator;
      } else {
        if (param1 !== undefined) {
          otherNumerator = param1;
        } else {
          otherNumerator = 1;
        }

        if (param2 !== undefined) {
          otherDenominator = param2;
        } else {
          otherDenominator = 1;
        }
      }

      return this.set(this.numerator * otherDenominator, this.denominator * otherNumerator);
    },

Simplifies both sides and checks if they are equal.

    equals: function(compare) {
      var a = Vex.Flow.Fraction.__compareA.copy(compare).simplify();
      var b = Vex.Flow.Fraction.__compareB.copy(this).simplify();

      return (a.numerator === b.numerator) && (a.denominator === b.denominator);
    },

Greater than operator.

    greaterThan: function(compare) {
      var a = Vex.Flow.Fraction.__compareB.copy(this);
      a.subtract(compare);
      return (a.numerator > 0);
    },

Greater than or equals operator.

    greaterThanEquals: function(compare) {
      var a = Vex.Flow.Fraction.__compareB.copy(this);
      a.subtract(compare);
      return (a.numerator >= 0);
    },

Less than operator.

    lessThan: function(compare) {
      return !(this.greaterThanEquals(compare));
    },

Less than or equals operator.

    lessThanEquals: function(compare) {
      return !(this.greaterThan(compare));
    },

Creates a new copy with this current values.

    clone: function() {
      return new Vex.Flow.Fraction(this.numerator, this.denominator);
    },

Copies value of another Fraction into itself.

    copy: function(copy) {
      return this.set(copy.numerator, copy.denominator);
    },

Returns the integer component eg. (4/2) == 2

    quotient: function() {
      return Math.floor(this.numerator / this.denominator);
    },

Returns the fraction component when reduced to a mixed number

    fraction: function() {
      return this.numerator % this.denominator;
    },

Returns the absolute value

    abs: function() {
      this.denominator = Math.abs(this.denominator);
      this.numerator = Math.abs(this.numerator);
      return this;
    },

Returns a raw string representation

    toString: function() {
      return this.numerator + '/' + this.denominator;
    },

Returns a simplified string respresentation

    toSimplifiedString: function() {
      return Vex.Flow.Fraction.__tmp.copy(this).simplify().toString();
    },

Returns string representation in mixed form

    toMixedString: function() {
      var s = '';
      var q = this.quotient();
      var f = Vex.Flow.Fraction.__tmp.copy(this);

      if (q < 0) {
        f.abs().fraction();
      } else {
        f.fraction();
      }

      if (q !== 0) {
        s += q;

        if (f.numerator !== 0) {
          s += ' ' + f.toSimplifiedString();
        }
      } else {
        if (f.numerator === 0) {
          s = '0';
        } else {
          s = f.toSimplifiedString();
        }
      }

      return s;
    },

Parses a fraction string

    parse: function(str) {
      var i = str.split('/');
      var n = parseInt(i[0], 10);
      var d = (i[1]) ? parseInt(i[1], 10) : 1;

      return this.set(n, d);
    }
  };

Temporary cached objects

  Fraction.__compareA = new Fraction();
  Fraction.__compareB = new Fraction();
  Fraction.__tmp = new Fraction();

  return Fraction;
}());

h


text:
angular.module('siwtngbp.httperror', [
  'ui.router',
  'ngStorage'
]).config([
  '$stateProvider',
  function config($stateProvider) {
    $stateProvider.state('httperror', {
      url: '/httperror',
      views: {
        'main': {
          controller: 'HttpErrorCtrl',
          templateUrl: 'httperror/httperror.tpl.html'
        }
      },
      data: { pageTitle: 'HTTP Problem' }
    });
  }
]).controller('HttpErrorCtrl', [
  '$scope',
  '$injector',
  function httperrorController($scope, $injector) {
    var controller = this;
    var log = $injector.get('$log');
    var sessionStorage = $injector.get('$sessionStorage');
    var state = $injector.get('$state');
    var timeout = $injector.get('$timeout');
    $scope.$on('$viewContentLoaded', function contentLoaded() {
      log.debug('HttpErrorCtrl content loaded');
    });
    $scope.$on('$destroy', function destroyed() {
      log.debug('HttpErrorCtrl destroyed');
      controller = null;
      $scope = null;
    });
    $scope.errorMessage = 'oh, had some problems fetching something from the API';
    var statusCode = sessionStorage.httpStatus;
    if (statusCode) {
      if (statusCode >= 500) {
        $scope.errorMessage = 'Please check the API server';
      } else if (statusCode >= 400) {
        if (sessionStorage.session) {
          sessionStorage.session = '';
          sessionStorage.authentication = '';
          $scope.errorMessage = 'Your session may have expired, please login again';
          timeout(function () {
            state.go('login');
          }, 5000);
        } else {
          sessionStorage.authentication = '';
          $scope.errorMessage = 'Not sure what happened there, could you try that again?';
          timeout(function () {
            state.go('home');
          }, 5000);
        }
      }
    } else {
      sessionStorage.session = '';
      sessionStorage.authentication = '';
      $scope.errorMessage = 'Please check the API server is available';
    }
  }
]);
;

redpajama_set_name: RedPajamaGithub


text:
// https://github.com/svaarala/duktape/issues/2207

/*===
{"foo":0,"nonEnumerable":0}
===*/

Object.defineProperty(Array.prototype, 0, { set: function () { } });

function jsonStringifyOwnKeysProxyTest () {
  target = { foo: 0, nonEnumerable: 0 };
  proxy = new Proxy(target, { $: function () { }, ownKeys: function () { return [ 'foo', 'nonEnumerable' ] } });
  print(String(JSON.stringify(proxy)));
}

jsonStringifyOwnKeysProxyTest();


text:
Material * Material::active_material = NULL;

Material::Material()
{
	ResourceManager *rm = ResourceManager::getInstance();
	shaders = rm->getDefaultShaders();
	texture = rm->getTexture("data/white.bmp");
	ambient = glm::vec4(0.2f, 0.2f, 0.2f, 1.0f);
	diffuse = glm::vec4(1.0f);
	specular = glm::vec4(0.0f);
	shininess = 1;
}

Material::~Material()
{
}

void Material::use()
{
	if (active_material == this)
		return;
	active_material = this;
	doUse();
}

void Material::doUse()
{
	shaders->setUniformMaterial(ambient, diffuse, specular, shininess);
	texture->use(GLSLProgram::TEXUNIT_COLOR);
}

MaterialSelection::MaterialSelection(Material &mat)
	: ps(*mat.shaders.getRawPointer())
{
	selected = &mat;
	previous = active_material;
	mat.use();
}

MaterialSelection::~MaterialSelection()
{
	//assert(selected == active_material);
	//if (previous)
		//previous->use();
}

GLSLProgram * MaterialSelection::getSelectedShaders()
{
	return selected->shaders.getRawPointer();
}

bool ConfigurableMaterial::loadDescriptionFile(const char *path)
{
	std::ifstream source_stream(path);
	if (!source_stream) {
		printf("Could not open material %s\n", path);
		return false;
	}

	ResourceManager *rm = ResourceManager::getInstance();
	std::string line;
	while (std::getline(source_stream, line).good()) {
		const char *cstr = line.c_str();

		if (3 == sscanf(cstr, "ambient %f %f %f %f",
					&ambient.r, &ambient.g, &ambient.b, &ambient.a))
			continue;

		if (3 == sscanf(cstr, "diffuse %f %f %f %f",
					&diffuse.r, &diffuse.g, &diffuse.b, &diffuse.a))
			continue;

		if (3 == sscanf(cstr, "specular %f %f %f %f",
					&specular.r, &specular.g, &specular.b, &specular.a))
			continue;

		if (1 == sscanf(cstr, "shininess %f",
					&shininess))
			continue;

		char texpath[2048];
		if (1 == sscanf(cstr, "texture %s", texpath)) {
			texture = rm->getTexture(texpath);
			continue;
		}

		int unit_id;
		char sampler_name[2048];
		if (2 == sscanf(cstr, "texsampler %s %s", sampler_name, texpath)) {
			unit_id = shaders->getTextureUnit(sampler_name);
			printf("sampler %s unit %d\n", sampler_name, unit_id);
			textures.push_back(std::make_pair(
						unit_id,
						rm->getTexture(texpath)));
			continue;
		}

		char vs[2048], fs[2048];
		if (2 == sscanf(cstr, "shaders vertex %s fragment %s", vs, fs)) {
			shaders = rm->getShaders(vs, fs);
			continue;
		}
	}

	return true;
}

void ConfigurableMaterial::doUse()
{
	Material::doUse();
	for (std::list< std::pair< int, ResourceHandle<Texture> > >::iterator
			it = textures.begin(), it_end = textures.end();
			it != it_end; it++)
		it->second->use(it->first);
}


text:
package org.assertj.core.internal.files;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.catchThrowableOfType;
import static org.assertj.core.api.BDDAssertions.then;
import static org.assertj.core.error.ShouldBeDirectory.shouldBeDirectory;
import static org.assertj.core.error.ShouldNotBeEmpty.shouldNotBeEmpty;
import static org.assertj.core.util.AssertionsUtil.expectAssertionError;
import static org.assertj.core.util.FailureMessages.actualIsNull;
import static org.assertj.core.util.Files.newFile;
import static org.assertj.core.util.Files.newFolder;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;

import java.io.File;
import java.io.FileFilter;

import org.assertj.core.api.AssertionInfo;
import org.assertj.core.internal.Files;
import org.assertj.core.internal.FilesBaseTest;
import org.junit.jupiter.api.Test;

/**
 * Tests for <code>{@link Files#assertIsNotEmptyDirectory(AssertionInfo, File)}</code>
 *
 * @author Valeriy Vyrva
 */
class Files_assertIsNotEmptyDirectory_Test extends FilesBaseTest {

  @Test
  void should_pass_if_actual_is_not_empty() {
    // GIVEN
    File actual = newFolder(tempDir.getAbsolutePath() + "/folder");
    newFile(actual.getAbsolutePath() + "/Test.java");
    // THEN
    files.assertIsNotEmptyDirectory(INFO, actual);
  }

  @Test
  void should_fail_if_actual_is_empty() {
    // GIVEN
    File actual = newFolder(tempDir.getAbsolutePath() + "/folder");
    // WHEN
    expectAssertionError(() -> files.assertIsNotEmptyDirectory(INFO, actual));
    // THEN
    verify(failures).failure(INFO, shouldNotBeEmpty());
  }

  @Test
  void should_fail_if_actual_is_null() {
    // GIVEN
    File actual = null;
    // WHEN
    AssertionError error = expectAssertionError(() -> files.assertIsNotEmptyDirectory(INFO, actual));
    // THEN
    then(error).hasMessage(actualIsNull());
  }

  @Test
  void should_fail_if_actual_does_not_exist() {
    // GIVEN
    File actual = new File("xyz");
    // WHEN
    expectAssertionError(() -> files.assertIsNotEmptyDirectory(INFO, actual));
    // THEN
    verify(failures).failure(INFO, shouldBeDirectory(actual));
  }

  @Test
  void should_fail_if_actual_exists_but_is_not_directory() {
    // GIVEN
    File actual = newFile(tempDir.getAbsolutePath() + "/Test.java");
    // WHEN
    expectAssertionError(() -> files.assertIsNotEmptyDirectory(INFO, actual));
    // THEN
    verify(failures).failure(INFO, shouldBeDirectory(actual));
  }

  // use mock as it's hard to simulate listFiles(FileFilter.class) to return null
  @Test
  void should_throw_error_on_null_listing() {
    // GIVEN
    File actual = mock(File.class);
    given(actual.exists()).willReturn(true);
    given(actual.isDirectory()).willReturn(true);
    given(actual.listFiles(any(FileFilter.class))).willReturn(null);
    // WHEN
    Throwable error = catchThrowableOfType(() -> files.assertIsNotEmptyDirectory(INFO, actual), NullPointerException.class);
    // THEN
    assertThat(error).hasMessage("Directory listing should not be null");
  }
}


text:
<?php

/**
 * Class FACTFinder_Campaigns_Model_Observer
 *
 * @category Mage
 * @package FACTFinder_Campaigns
 * @author Flagbit Magento Team <magento@flagbit.de>
 * @copyright Copyright (c) 2016, Flagbit GmbH & Co. KG
 * @license https://opensource.org/licenses/MIT  The MIT License (MIT)
 * @link http://www.flagbit.de
 */
class FACTFinder_Campaigns_Model_Observer
{

    /**
     * Handles campaign redirects on
     * controller_action_layout_generate_blocks_after
     *
     * @param Varien_Object $observer
     */
    public function handleCampaignsRedirect($observer)
    {
        if (!Mage::helper('factfinder')->isEnabled('campaigns')
            || (Mage::registry('current_product') && !Mage::helper('factfinder_campaigns')->canShowCampaignsOnProduct())
        ) {
            return;
        }

        if (!Mage::registry('current_layer') && !Mage::registry('current_product')) {
            return;
        }

        if (Mage::registry('current_product')) {
            $product = Mage::registry('current_product');
            $ids = array($product->getData(Mage::helper('factfinder_campaigns')->getIdFieldName()));
            $handler = Mage::getSingleton('factfinder_campaigns/handler_product', $ids);
        } elseif (Mage::helper('factfinder/search')->getIsOnSearchPage()) {
            $handler = Mage::getSingleton('factfinder_campaigns/handler_search');
        } else {
            return;
        }

        $redirect = $handler->getRedirect();

        if ($redirect) {
            // handle relative urls
            if (!Zend_Uri::check($redirect)) {
                $redirect = Mage::getBaseUrl() . $redirect;
            }

            $response = Mage::app()->getResponse();
            $response->setRedirect($redirect);
            $response->sendResponse();
            exit;
        }
    }

}


text:
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;

using FluentMigrator.Expressions;
using FluentMigrator.Infrastructure;
using FluentMigrator.Runner;
using FluentMigrator.Runner.Announcers;
using FluentMigrator.Runner.Exceptions;
using FluentMigrator.Runner.Generators.SqlServer;
using FluentMigrator.Runner.Initialization;
using FluentMigrator.Runner.Processors;
using FluentMigrator.Runner.Processors.Firebird;
using FluentMigrator.Runner.Processors.MySql;
using FluentMigrator.Runner.Processors.Postgres;
using FluentMigrator.Runner.Processors.SqlAnywhere;
using FluentMigrator.Runner.Processors.SQLite;
using FluentMigrator.Runner.Processors.SqlServer;
using FluentMigrator.Tests.Integration.Migrations;
using FluentMigrator.Tests.Integration.Migrations.Tagged;
using FluentMigrator.Tests.Unit;

using Moq;

using NUnit.Framework;

using Shouldly;

namespace FluentMigrator.Tests.Integration
{
    [TestFixture]
    [Category("Integration")]
    [Obsolete]
    public class ObsoleteMigrationRunnerTests : ObsoleteIntegrationTestBase
    {
        private IRunnerContext _runnerContext;

        [SetUp]
        public void SetUp()
        {
            _runnerContext = new RunnerContext(new TextWriterAnnouncer(TestContext.Out))
                                        {
                                            Namespace = "FluentMigrator.Tests.Integration.Migrations"
                                        };
        }

        [Test]
        [Category("Firebird")]
        [Category("MySql")]
        [Category("SQLite")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        [Category("SqlAnywhere16")]
        public void CanRunMigration()
        {
            ExecuteWithSupportedProcessors(processor =>
                {
                    var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);

                    runner.Up(new TestCreateAndDropTableMigration());

                    processor.TableExists(null, "TestTable").ShouldBeTrue();

                    // This is a hack until MigrationVersionRunner and MigrationRunner are refactored and merged together
                    //processor.CommitTransaction();

                    runner.Down(new TestCreateAndDropTableMigration());
                    processor.TableExists(null, "TestTable").ShouldBeFalse();
                });
        }

        [Test]
        [Category("Firebird")]
        [Category("MySql")]
        [Category("SQLite")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        [Category("SqlAnywhere16")]
        public void CanSilentlyFail()
        {
            try
            {
                var processorOptions = new Mock<IMigrationProcessorOptions>();
                processorOptions.SetupGet(x => x.PreviewOnly).Returns(false);

                var processor = new Mock<IMigrationProcessor>();
                processor.Setup(x => x.Process(It.IsAny<CreateForeignKeyExpression>())).Throws(new Exception("Error"));
                processor.Setup(x => x.Process(It.IsAny<DeleteForeignKeyExpression>())).Throws(new Exception("Error"));
                processor.Setup(x => x.Options).Returns(processorOptions.Object);

                var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor.Object) { SilentlyFail = true };

                runner.Up(new TestForeignKeySilentFailure());

                runner.CaughtExceptions.Count.ShouldBeGreaterThan(0);

                runner.Down(new TestForeignKeySilentFailure());
                runner.CaughtExceptions.Count.ShouldBeGreaterThan(0);
            }
            finally
            {
                ExecuteWithSupportedProcessors(processor =>
                {
                    MigrationRunner testRunner = SetupMigrationRunner(processor);
                    testRunner.RollbackToVersion(0);
                }, false);
            }
        }

        [Test]
        [Category("Firebird")]
        [Category("MySql")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        [Category("SqlAnywhere16")]
        public void CanApplyForeignKeyConvention()
        {
            ExecuteWithSupportedProcessors(
                processor =>
                {
                    var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);

                    runner.Up(new TestForeignKeyNamingConvention());
                    processor.ConstraintExists(null, "Users", "FK_Users_GroupId_Groups_GroupId").ShouldBeTrue();

                    runner.Down(new TestForeignKeyNamingConvention());
                    processor.ConstraintExists(null, "Users", "FK_Users_GroupId_Groups_GroupId").ShouldBeFalse();
                }, false, typeof(SQLiteProcessor));
        }

        [Test]
        [Category("MySql")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        [Category("SqlAnywhere16")]
        public void CanApplyForeignKeyConventionWithSchema()
        {
            ExecuteWithSupportedProcessors(
                processor =>
                {
                    var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);

                    runner.Up(new TestForeignKeyNamingConventionWithSchema());

                    processor.ConstraintExists("TestSchema", "Users", "FK_Users_GroupId_Groups_GroupId").ShouldBeTrue();
                    runner.Down(new TestForeignKeyNamingConventionWithSchema());
                }, false, new []{typeof(SQLiteProcessor), typeof(FirebirdProcessor)});
        }

        [Test]
        [Category("Firebird")]
        [Category("MySql")]
        [Category("SQLite")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        [Category("SqlAnywhere16")]
        public void CanApplyIndexConvention()
        {
            ExecuteWithSupportedProcessors(
                processor =>
                {
                    var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);

                    runner.Up(new TestIndexNamingConvention());
                    processor.IndexExists(null, "Users", "IX_Users_GroupId").ShouldBeTrue();
                    processor.TableExists(null, "Users").ShouldBeTrue();

                    runner.Down(new TestIndexNamingConvention());
                    processor.IndexExists(null, "Users", "IX_Users_GroupId").ShouldBeFalse();
                    processor.TableExists(null, "Users").ShouldBeFalse();
                });
        }

        [Test]
        [Category("Firebird")]
        [Category("MySql")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        [Category("SqlAnywhere16")]
        public void CanApplyUniqueConvention()
        {
            ExecuteWithSupportedProcessors(
                processor =>
                {
                    var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);

                    runner.Up(new TestUniqueConstraintNamingConvention());
                    processor.ConstraintExists(null, "Users", "UC_Users_GroupId").ShouldBeTrue();
                    processor.ConstraintExists(null, "Users", "UC_Users_AccountId").ShouldBeTrue();
                    processor.TableExists(null, "Users").ShouldBeTrue();

                    runner.Down(new TestUniqueConstraintNamingConvention());
                    processor.ConstraintExists(null, "Users", "UC_Users_GroupId").ShouldBeFalse();
                    processor.ConstraintExists(null, "Users", "UC_Users_AccountId").ShouldBeFalse();
                    processor.TableExists(null, "Users").ShouldBeFalse();
                },
                false,
                typeof(SQLiteProcessor));
        }

        [Test]
        [Category("Firebird")]
        [Category("MySql")]
        [Category("SQLite")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        [Category("SqlAnywhere16")]
        public void CanApplyIndexConventionWithSchema()
        {
            ExecuteWithSupportedProcessors(
                processor =>
                {
                    var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);

                    runner.Up(new TestIndexNamingConventionWithSchema());
                    processor.IndexExists("TestSchema", "Users", "IX_Users_GroupId").ShouldBeTrue();
                    processor.TableExists("TestSchema", "Users").ShouldBeTrue();

                    runner.Down(new TestIndexNamingConventionWithSchema());
                    processor.IndexExists("TestSchema", "Users", "IX_Users_GroupId").ShouldBeFalse();
                    processor.TableExists("TestSchema", "Users").ShouldBeFalse();
                });
        }

        [Test]
        [Category("Firebird")]
        [Category("MySql")]
        [Category("SQLite")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        [Category("SqlAnywhere16")]
        public void CanCreateAndDropIndex()
        {
            ExecuteWithSupportedProcessors(
                processor =>
                {
                    var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);

                    runner.Up(new TestCreateAndDropTableMigration());
                    processor.IndexExists(null, "TestTable", "IX_TestTable_Name").ShouldBeFalse();

                    runner.Up(new TestCreateAndDropIndexMigration());
                    processor.IndexExists(null, "TestTable", "IX_TestTable_Name").ShouldBeTrue();

                    runner.Down(new TestCreateAndDropIndexMigration());
                    processor.IndexExists(null, "TestTable", "IX_TestTable_Name").ShouldBeFalse();

                    runner.Down(new TestCreateAndDropTableMigration());
                    processor.IndexExists(null, "TestTable", "IX_TestTable_Name").ShouldBeFalse();

                    //processor.CommitTransaction();
                });
        }

        [Test]
        [Category("MySql")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        [Category("SqlAnywhere16")]
        public void CanCreateAndDropIndexWithSchema()
        {
            ExecuteWithSupportedProcessors(
                processor =>
                {
                    var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);

                    runner.Up(new TestCreateSchema());

                    runner.Up(new TestCreateAndDropTableMigrationWithSchema());
                    processor.IndexExists("TestSchema", "TestTable", "IX_TestTable_Name").ShouldBeFalse();

                    runner.Up(new TestCreateAndDropIndexMigrationWithSchema());
                    processor.IndexExists("TestSchema", "TestTable", "IX_TestTable_Name").ShouldBeTrue();

                    runner.Down(new TestCreateAndDropIndexMigrationWithSchema());
                    processor.IndexExists("TestSchema", "TestTable", "IX_TestTable_Name").ShouldBeFalse();

                    runner.Down(new TestCreateAndDropTableMigrationWithSchema());
                    processor.IndexExists("TestSchema", "TestTable", "IX_TestTable_Name").ShouldBeFalse();

                    runner.Down(new TestCreateSchema());
                    //processor.CommitTransaction();
                }, false, new[] { typeof(SQLiteProcessor), typeof(FirebirdProcessor) });
        }

        [Test]
        [Category("Firebird")]
        [Category("MySql")]
        [Category("SQLite")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        [Category("SqlAnywhere16")]
        public void CanRenameTable()
        {
            ExecuteWithSupportedProcessors(
                processor =>
                {
                    var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);

                    runner.Up(new TestCreateAndDropTableMigration());
                    processor.TableExists(null, "TestTable2").ShouldBeTrue();

                    runner.Up(new TestRenameTableMigration());
                    processor.TableExists(null, "TestTable2").ShouldBeFalse();
                    processor.TableExists(null, "TestTable'3").ShouldBeTrue();

                    runner.Down(new TestRenameTableMigration());
                    processor.TableExists(null, "TestTable'3").ShouldBeFalse();
                    processor.TableExists(null, "TestTable2").ShouldBeTrue();

                    runner.Down(new TestCreateAndDropTableMigration());
                    processor.TableExists(null, "TestTable2").ShouldBeFalse();

                    //processor.CommitTransaction();
                });
        }

        [Test]
        [Category("Firebird")]
        [Category("MySql")]
        [Category("SQLite")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        [Category("SqlAnywhere16")]
        public void CanRenameTableWithSchema()
        {
            ExecuteWithSupportedProcessors(
                processor =>
                {
                    var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);

                    runner.Up(new TestCreateSchema());

                    runner.Up(new TestCreateAndDropTableMigrationWithSchema());
                    processor.TableExists("TestSchema", "TestTable2").ShouldBeTrue();

                    runner.Up(new TestRenameTableMigrationWithSchema());
                    processor.TableExists("TestSchema", "TestTable2").ShouldBeFalse();
                    processor.TableExists("TestSchema", "TestTable'3").ShouldBeTrue();

                    runner.Down(new TestRenameTableMigrationWithSchema());
                    processor.TableExists("TestSchema", "TestTable'3").ShouldBeFalse();
                    processor.TableExists("TestSchema", "TestTable2").ShouldBeTrue();

                    runner.Down(new TestCreateAndDropTableMigrationWithSchema());
                    processor.TableExists("TestSchema", "TestTable2").ShouldBeFalse();

                    runner.Down(new TestCreateSchema());

                    //processor.CommitTransaction();
                });
        }

        [Test]
        [Category("Firebird")]
        [Category("MySql")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        [Category("SqlAnywhere16")]
        public void CanRenameColumn()
        {
            ExecuteWithSupportedProcessors(
                processor =>
                {
                    var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);

                    runner.Up(new TestCreateAndDropTableMigration());
                    processor.ColumnExists(null, "TestTable2", "Name").ShouldBeTrue();

                    runner.Up(new TestRenameColumnMigration());
                    processor.ColumnExists(null, "TestTable2", "Name").ShouldBeFalse();
                    processor.ColumnExists(null, "TestTable2", "Name'3").ShouldBeTrue();

                    runner.Down(new TestRenameColumnMigration());
                    processor.ColumnExists(null, "TestTable2", "Name'3").ShouldBeFalse();
                    processor.ColumnExists(null, "TestTable2", "Name").ShouldBeTrue();

                    runner.Down(new TestCreateAndDropTableMigration());
                    processor.ColumnExists(null, "TestTable2", "Name").ShouldBeFalse();
                }, true, typeof(SQLiteProcessor));
        }

        [Test]
        [Category("MySql")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        [Category("SqlAnywhere16")]
        public void CanRenameColumnWithSchema()
        {
            ExecuteWithSupportedProcessors(
                processor =>
                {
                    var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);

                    runner.Up(new TestCreateSchema());

                    runner.Up(new TestCreateAndDropTableMigrationWithSchema());
                    processor.ColumnExists("TestSchema", "TestTable2", "Name").ShouldBeTrue();

                    runner.Up(new TestRenameColumnMigrationWithSchema());
                    processor.ColumnExists("TestSchema", "TestTable2", "Name").ShouldBeFalse();
                    processor.ColumnExists("TestSchema", "TestTable2", "Name'3").ShouldBeTrue();

                    runner.Down(new TestRenameColumnMigrationWithSchema());
                    processor.ColumnExists("TestSchema", "TestTable2", "Name'3").ShouldBeFalse();
                    processor.ColumnExists("TestSchema", "TestTable2", "Name").ShouldBeTrue();

                    runner.Down(new TestCreateAndDropTableMigrationWithSchema());
                    processor.ColumnExists("TestSchema", "TestTable2", "Name").ShouldBeFalse();

                    runner.Down(new TestCreateSchema());
                }, true, typeof(SQLiteProcessor), typeof(FirebirdProcessor));
        }

        [Test]
        [Category("Firebird")]
        [Category("MySql")]
        [Category("SQLite")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        [Category("SqlAnywhere16")]
        public void CanLoadMigrations()
        {
            ExecuteWithSupportedProcessors(processor =>
            {
                var runnerContext = new RunnerContext(new TextWriterAnnouncer(TestContext.Out))
                {
                    Namespace = typeof(TestMigration).Namespace,
                };

                var runner = new MigrationRunner(typeof(MigrationRunnerTests).Assembly, runnerContext, processor);

                //runner.Processor.CommitTransaction();

                runner.MigrationLoader.LoadMigrations().ShouldNotBeNull();
            });
        }

        [Test]
        [Category("Firebird")]
        [Category("MySql")]
        [Category("SQLite")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        [Category("SqlAnywhere16")]
        public void CanLoadVersion()
        {
            ExecuteWithSupportedProcessors(processor =>
            {
                var runnerContext = new RunnerContext(new TextWriterAnnouncer(TestContext.Out))
                {
                    Namespace = typeof(TestMigration).Namespace,
                };

                var runner = new MigrationRunner(typeof(TestMigration).Assembly, runnerContext, processor);

                //runner.Processor.CommitTransaction();
                runner.VersionLoader.VersionInfo.ShouldNotBeNull();
            });
        }

        [Test]
        [Category("Firebird")]
        [Category("MySql")]
        [Category("SQLite")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        [Category("SqlAnywhere16")]
        public void CanRunMigrations()
        {
            ExecuteWithSupportedProcessors(processor =>
            {
                MigrationRunner runner = SetupMigrationRunner(processor);

                runner.MigrateUp(false);

                runner.VersionLoader.VersionInfo.HasAppliedMigration(1).ShouldBeTrue();
                runner.VersionLoader.VersionInfo.HasAppliedMigration(2).ShouldBeTrue();
                runner.VersionLoader.VersionInfo.HasAppliedMigration(3).ShouldBeTrue();
                runner.VersionLoader.VersionInfo.HasAppliedMigration(4).ShouldBeTrue();
                runner.VersionLoader.VersionInfo.HasAppliedMigration(5).ShouldBeTrue();
                runner.VersionLoader.VersionInfo.HasAppliedMigration(6).ShouldBeTrue();
                runner.VersionLoader.VersionInfo.Latest().ShouldBe(6);

                runner.RollbackToVersion(0, false);
            });
        }

        [Test]
        [Category("Firebird")]
        [Category("MySql")]
        [Category("SQLite")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        [Category("SqlAnywhere16")]
        public void CanMigrateASpecificVersion()
        {
            ExecuteWithSupportedProcessors(processor =>
            {
                MigrationRunner runner = SetupMigrationRunner(processor);
                try
                {
                    runner.MigrateUp(1, false);

                    runner.VersionLoader.VersionInfo.HasAppliedMigration(1).ShouldBeTrue();
                    processor.TableExists(null, "Users").ShouldBeTrue();
                }
                finally
                {
                    runner.RollbackToVersion(0, false);
                }
            });
        }

        [Test]
        [Category("Firebird")]
        [Category("MySql")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        [Category("SqlAnywhere16")]
        public void CanMigrateASpecificVersionDown()
        {
            try
            {
                ExecuteWithSupportedProcessors(processor =>
                {
                    MigrationRunner runner = SetupMigrationRunner(processor);

                    runner.MigrateUp(1, false);

                    runner.VersionLoader.VersionInfo.HasAppliedMigration(1).ShouldBeTrue();
                    processor.TableExists(null, "Users").ShouldBeTrue();

                    MigrationRunner testRunner = SetupMigrationRunner(processor);
                    testRunner.MigrateDown(0, false);
                    testRunner.VersionLoader.VersionInfo.HasAppliedMigration(1).ShouldBeFalse();
                    processor.TableExists(null, "Users").ShouldBeFalse();
                }, false, typeof(SQLiteProcessor));
            }
            finally
            {
                ExecuteWithSupportedProcessors(processor =>
                {
                    MigrationRunner testRunner = SetupMigrationRunner(processor);
                    testRunner.RollbackToVersion(0, false);
                }, false);
            }
        }

        [Test]
        [Category("Firebird")]
        [Category("MySql")]
        [Category("SQLite")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        [Category("SqlAnywhere16")]
        public void RollbackAllShouldRemoveVersionInfoTable()
        {
            ExecuteWithSupportedProcessors(processor =>
            {
                MigrationRunner runner = SetupMigrationRunner(processor);

                runner.MigrateUp(2);

                processor.TableExists(runner.VersionLoader.VersionTableMetaData.SchemaName, runner.VersionLoader.VersionTableMetaData.TableName).ShouldBeTrue();
            });

            ExecuteWithSupportedProcessors(processor =>
            {
                MigrationRunner runner = SetupMigrationRunner(processor);
                runner.RollbackToVersion(0);

                processor.TableExists(runner.VersionLoader.VersionTableMetaData.SchemaName, runner.VersionLoader.VersionTableMetaData.TableName).ShouldBeFalse();
            });
        }

        [Test]
        [Category("SqlServer2008")]
        public void MigrateUpWithSqlServerProcessorShouldCommitItsTransaction()
        {
            if (!IntegrationTestOptions.SqlServer2008.IsEnabled)
                return;

            var connection = new SqlConnection(IntegrationTestOptions.SqlServer2008.ConnectionString);
            var processor = new SqlServerProcessor(new[] { "SqlServer2008" }, connection, new SqlServer2008Generator(), new TextWriterAnnouncer(TestContext.Out), new ProcessorOptions(), new SqlServerDbFactory());

            MigrationRunner runner = SetupMigrationRunner(processor);
            runner.MigrateUp();

            try
            {
                processor.WasCommitted.ShouldBeTrue();

            }
            finally
            {
                CleanupTestSqlServerDatabase(connection, processor);
            }
        }

        [Test]
        [Category("SqlServer2008")]
        public void MigrateUpSpecificVersionWithSqlServerProcessorShouldCommitItsTransaction()
        {
            if (!IntegrationTestOptions.SqlServer2008.IsEnabled)
                return;

            var connection = new SqlConnection(IntegrationTestOptions.SqlServer2008.ConnectionString);
            var processor = new SqlServerProcessor(new[] { "SqlServer2008" }, connection, new SqlServer2008Generator(), new TextWriterAnnouncer(TestContext.Out), new ProcessorOptions(), new SqlServerDbFactory());

            MigrationRunner runner = SetupMigrationRunner(processor);
            runner.MigrateUp(1);

            try
            {
                processor.WasCommitted.ShouldBeTrue();

            }
            finally
            {
                CleanupTestSqlServerDatabase(connection, processor);
            }
        }

        [Test]
        [Category("Firebird")]
        [Category("MySql")]
        [Category("SQLite")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        [Category("SqlAnywhere16")]
        public void MigrateUpWithTaggedMigrationsShouldOnlyApplyMatchedMigrations()
        {
            ExecuteWithSupportedProcessors(processor =>
            {
                var assembly = typeof(TenantATable).Assembly;

                var runnerContext = new RunnerContext(new TextWriterAnnouncer(TestContext.Out))
                {
                    Namespace = typeof(TenantATable).Namespace,
                    Tags = new[] { "TenantA" }
                };

                var runner = new MigrationRunner(assembly, runnerContext, processor);

                try
                {
                    runner.MigrateUp(false);

                    processor.TableExists(null, "TenantATable").ShouldBeTrue();
                    processor.TableExists(null, "NormalTable").ShouldBeTrue();
                    processor.TableExists(null, "TenantBTable").ShouldBeFalse();
                    processor.TableExists(null, "TenantAandBTable").ShouldBeTrue();
                }
                finally
                {
                    runner.RollbackToVersion(0);
                }
            });
        }

        [Test]
        [Category("Firebird")]
        [Category("MySql")]
        [Category("SQLite")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        [Category("SqlAnywhere16")]
        public void MigrateUpWithTaggedMigrationsAndUsingMultipleTagsShouldOnlyApplyMatchedMigrations()
        {
            ExecuteWithSupportedProcessors(processor =>
            {
                var assembly = typeof(TenantATable).Assembly;

                var runnerContext = new RunnerContext(new TextWriterAnnouncer(TestContext.Out))
                {
                    Namespace = typeof(TenantATable).Namespace,
                    Tags = new[] { "TenantA", "TenantB" }
                };

                var runner = new MigrationRunner(assembly, runnerContext, processor);

                try
                {
                    runner.MigrateUp(false);

                    processor.TableExists(null, "TenantATable").ShouldBeFalse();
                    processor.TableExists(null, "NormalTable").ShouldBeTrue();
                    processor.TableExists(null, "TenantBTable").ShouldBeFalse();
                    processor.TableExists(null, "TenantAandBTable").ShouldBeTrue();
                }
                finally
                {
                    new MigrationRunner(assembly, runnerContext, processor).RollbackToVersion(0);
                }
            });
        }

        [Test]
        [Category("Firebird")]
        [Category("MySql")]
        [Category("SQLite")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        [Category("SqlAnywhere16")]
        public void MigrateUpWithDifferentTaggedShouldIgnoreConcreteOfTagged()
        {
            ExecuteWithSupportedProcessors(processor =>
            {
                var assembly = typeof(TenantATable).Assembly;

                var runnerContext = new RunnerContext(new TextWriterAnnouncer(TestContext.Out))
                {
                    Namespace = typeof(TenantATable).Namespace,
                    Tags = new[] { "TenantB" }
                };

                var runner = new MigrationRunner(assembly, runnerContext, processor);

                try
                {
                    runner.MigrateUp(false);

                    processor.TableExists(null, "TenantATable").ShouldBeFalse();
                    processor.TableExists(null, "NormalTable").ShouldBeTrue();
                    processor.TableExists(null, "TenantBTable").ShouldBeTrue();
                }
                finally
                {
                    new MigrationRunner(assembly, runnerContext, processor).RollbackToVersion(0);
                }
            });
        }

        [Test]
        [Category("Firebird")]
        [Category("MySql")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        [Category("SqlAnywhere16")]
        public void MigrateDownWithDifferentTagsToMigrateUpShouldApplyMatchedMigrations()
        {
            var assembly = typeof(TenantATable).Assembly;
            var migrationsNamespace = typeof(TenantATable).Namespace;

            var runnerContext = new RunnerContext(new TextWriterAnnouncer(TestContext.Out))
            {
                Namespace = migrationsNamespace,
            };

            // Excluded SqliteProcessor as it errors on DB cleanup (RollbackToVersion).
            ExecuteWithSupportedProcessors(processor =>
            {
                try
                {
                    runnerContext.Tags = new[] { "TenantA" };

                    new MigrationRunner(assembly, runnerContext, processor).MigrateUp(false);

                    processor.TableExists(null, "TenantATable").ShouldBeTrue();
                    processor.TableExists(null, "NormalTable").ShouldBeTrue();
                    processor.TableExists(null, "TenantBTable").ShouldBeFalse();
                    processor.TableExists(null, "TenantAandBTable").ShouldBeTrue();

                    runnerContext.Tags = new[] { "TenantB" };

                    new MigrationRunner(assembly, runnerContext, processor).MigrateDown(0, false);

                    processor.TableExists(null, "TenantATable").ShouldBeTrue();
                    processor.TableExists(null, "NormalTable").ShouldBeFalse();
                    processor.TableExists(null, "TenantBTable").ShouldBeFalse();
                    processor.TableExists(null, "TenantAandBTable").ShouldBeFalse();
                }
                finally
                {
                    runnerContext.Tags = new[] { "TenantA" };

                    new MigrationRunner(assembly, runnerContext, processor).RollbackToVersion(0, false);
                }
            }, true, typeof(SQLiteProcessor));
        }

        [Test]
        [Category("SqlServer2008")]
        public void VersionInfoCreationScriptsOnlyGeneratedOnceInPreviewMode()
        {
            if (!IntegrationTestOptions.SqlServer2008.IsEnabled)
                return;

            var connection = new SqlConnection(IntegrationTestOptions.SqlServer2008.ConnectionString);
            var processorOptions = new ProcessorOptions { PreviewOnly = true };

            var outputSql = new StringWriter();
            var announcer = new TextWriterAnnouncer(outputSql){ ShowSql = true };

            var processor = new SqlServerProcessor(new[] { "SqlServer2008" }, connection, new SqlServer2008Generator(), announcer, processorOptions, new SqlServerDbFactory());

            try
            {
                var versionTableMetaData = new TestVersionTableMetaData();
                var asm = typeof(MigrationRunnerTests).Assembly;
                var runnerContext = new RunnerContext(announcer)
                {
                    Namespace = "FluentMigrator.Tests.Integration.Migrations",
                    PreviewOnly = true
                };

                var runner = new MigrationRunner(new SingleAssembly(asm), runnerContext, processor, versionTableMetaData);
                runner.MigrateUp(1, false);

                processor.CommitTransaction();

                string schemaName = versionTableMetaData.SchemaName;
                var schemaAndTableName = string.Format("[{0}].[{1}]", schemaName, TestVersionTableMetaData.TABLE_NAME);

                var outputSqlString = outputSql.ToString();

                var createSchemaMatches = new Regex(Regex.Escape(string.Format("CREATE SCHEMA [{0}]", schemaName)))
                    .Matches(outputSqlString).Count;
                var createTableMatches = new Regex(Regex.Escape("CREATE TABLE " + schemaAndTableName))
                    .Matches(outputSqlString).Count;
                var createIndexMatches = new Regex(Regex.Escape("CREATE UNIQUE CLUSTERED INDEX [" + TestVersionTableMetaData.UNIQUE_INDEX_NAME + "] ON " + schemaAndTableName))
                    .Matches(outputSqlString).Count;
                var alterTableMatches = new Regex(Regex.Escape("ALTER TABLE " + schemaAndTableName))
                    .Matches(outputSqlString).Count;

                System.Console.WriteLine(outputSqlString);

                createSchemaMatches.ShouldBe(1);
                createTableMatches.ShouldBe(1);
                alterTableMatches.ShouldBe(2);
                createIndexMatches.ShouldBe(1);

            }
            finally
            {
                CleanupTestSqlServerDatabase(connection, processor);
            }
        }

        [Test]
        [Category("Firebird")]
        [Category("MySql")]
        [Category("SQLite")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        [Category("SqlAnywhere16")]
        public void MigrateUpWithTaggedMigrationsShouldNotApplyAnyMigrationsIfNoTagsParameterIsPassedIntoTheRunner()
        {
            ExecuteWithSupportedProcessors(processor =>
            {
                var assembly = typeof(TenantATable).Assembly;

                var runnerContext = new RunnerContext(new TextWriterAnnouncer(TestContext.Out))
                {
                    Namespace = typeof(TenantATable).Namespace
                };

                var runner = new MigrationRunner(assembly, runnerContext, processor);

                try
                {
                    runner.MigrateUp(false);

                    processor.TableExists(null, "TenantATable").ShouldBeFalse();
                    processor.TableExists(null, "NormalTable").ShouldBeTrue();
                    processor.TableExists(null, "TenantBTable").ShouldBeFalse();
                    processor.TableExists(null, "TenantAandBTable").ShouldBeFalse();
                }
                finally
                {
                    runner.RollbackToVersion(0);
                }
            });
        }

        [Test]
        [Category("Firebird")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        [Category("SqlAnywhere16")]
        public void ValidateVersionOrderShouldDoNothingIfUnappliedMigrationVersionIsGreaterThanLatestAppliedMigration()
        {

            // Using SqlServer instead of SQLite as versions not deleted from VersionInfo table when using Sqlite.
            var excludedProcessors = new[] { typeof(SQLiteProcessor), typeof(MySqlProcessor), typeof(PostgresProcessor) };

            var assembly = typeof(Migrations.Interleaved.Pass3.User).Assembly;

            var runnerContext1 = new RunnerContext(new TextWriterAnnouncer(TestContext.Out)) { Namespace = typeof(Migrations.Interleaved.Pass2.User).Namespace };
            var runnerContext2 = new RunnerContext(new TextWriterAnnouncer(TestContext.Out)) { Namespace = typeof(Migrations.Interleaved.Pass3.User).Namespace };

            try
            {
                ExecuteWithSupportedProcessors(processor =>
                {
                    var migrationRunner = new MigrationRunner(assembly, runnerContext1, processor);

                    migrationRunner.MigrateUp(3);
                }, false, excludedProcessors);

                ExecuteWithSupportedProcessors(processor =>
                {
                    var migrationRunner = new MigrationRunner(assembly, runnerContext2, processor);

                    Assert.DoesNotThrow(migrationRunner.ValidateVersionOrder);
                }, false, excludedProcessors);
            }
            finally
            {
                ExecuteWithSupportedProcessors(processor =>
                {
                    var migrationRunner = new MigrationRunner(assembly, runnerContext2, processor);
                    migrationRunner.RollbackToVersion(0);
                }, true, excludedProcessors);
            }
        }

        [Test]
        [Category("Firebird")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        [Category("SqlAnywhere16")]
        public void ValidateVersionOrderShouldThrowExceptionIfUnappliedMigrationVersionIsLessThanLatestAppliedMigration()
        {
            // Using SqlServer instead of SQLite as versions not deleted from VersionInfo table when using Sqlite.
            var excludedProcessors = new[] { typeof(MySqlProcessor), typeof(SQLiteProcessor) };

            var assembly = typeof(Migrations.Interleaved.Pass3.User).Assembly;

            var runnerContext1 = new RunnerContext(new TextWriterAnnouncer(TestContext.Out)) { Namespace = typeof(Migrations.Interleaved.Pass2.User).Namespace };
            var runnerContext2 = new RunnerContext(new TextWriterAnnouncer(TestContext.Out)) { Namespace = typeof(Migrations.Interleaved.Pass3.User).Namespace };

            VersionOrderInvalidException caughtException = null;

            try
            {
                ExecuteWithSupportedProcessors(processor =>
                {
                    var migrationRunner = new MigrationRunner(assembly, runnerContext1, processor);
                    migrationRunner.MigrateUp();
                }, false, excludedProcessors);

                ExecuteWithSupportedProcessors(processor =>
                {
                    var migrationRunner = new MigrationRunner(assembly, runnerContext2, processor);
                    migrationRunner.ValidateVersionOrder();
                }, false, excludedProcessors);
            }
            catch (VersionOrderInvalidException ex)
            {
                caughtException = ex;
            }
            finally
            {
                ExecuteWithSupportedProcessors(processor =>
                {
                    var migrationRunner = new MigrationRunner(assembly, runnerContext2, processor);
                    migrationRunner.RollbackToVersion(0);
                }, true, excludedProcessors);
            }

            caughtException.ShouldNotBeNull();

            caughtException.InvalidMigrations.Count().ShouldBe(1);
            var keyValuePair = caughtException.InvalidMigrations.First();
            keyValuePair.Key.ShouldBe(200909060935);
            keyValuePair.Value.Migration.ShouldBeOfType<Migrations.Interleaved.Pass3.UserEmail>();
        }

        [Test]
        [Category("SqlServer2016")]
        public void CanCreateSequence()
        {
            if (!IntegrationTestOptions.SqlServer2016.IsEnabled)
            {
                Assert.Ignore("No processor found for the given action.");
            }

            ExecuteWithSqlServer2016(
                processor =>
                {
                    var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);

                    runner.Up(new TestCreateSequence());
                    processor.SequenceExists(null, "TestSequence");

                    runner.Down(new TestCreateSequence());
                    processor.SequenceExists(null, "TestSequence").ShouldBeFalse();
                },
                true,
                IntegrationTestOptions.SqlServer2016);
        }

        [Test]
        [Category("Postgres")]
        [Category("SqlServer2012")]
        public void CanCreateSequenceWithSchema()
        {
            if (!IntegrationTestOptions.SqlServer2012.IsEnabled && !IntegrationTestOptions.Postgres.IsEnabled)
            {
                Assert.Ignore("No processor found for the given action.");
            }

            Action<IMigrationProcessor> action = processor =>
            {
                var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);

                runner.Up(new TestCreateSchema());
                runner.Up(new TestCreateSequenceWithSchema());
                processor.SequenceExists("TestSchema", "TestSequence").ShouldBeTrue();

                runner.Down(new TestCreateSequenceWithSchema());
                runner.Down(new TestCreateSchema());
                processor.SequenceExists("TestSchema", "TestSequence").ShouldBeFalse();
            };

            if (IntegrationTestOptions.SqlServer2012.IsEnabled)
            {
                ExecuteWithSqlServer2012(
                    action,
                    true,
                    IntegrationTestOptions.SqlServer2012);
            }

            if (IntegrationTestOptions.Postgres.IsEnabled)
            {
                ExecuteWithPostgres(action, true, IntegrationTestOptions.Postgres);
            }
        }

        [Test]
        [Category("MySql")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        public void CanAlterColumnWithSchema()
        {
            ExecuteWithSupportedProcessors(
                processor =>
                {
                    var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);

                    runner.Up(new TestCreateSchema());

                    runner.Up(new TestCreateAndDropTableMigrationWithSchema());
                    processor.ColumnExists("TestSchema", "TestTable2", "Name2").ShouldBeTrue();
                    processor.DefaultValueExists("TestSchema", "TestTable", "Name", "Anonymous").ShouldBeTrue();

                    runner.Up(new TestAlterColumnWithSchema());
                    processor.ColumnExists("TestSchema", "TestTable2", "Name2").ShouldBeTrue();

                    runner.Down(new TestAlterColumnWithSchema());
                    processor.ColumnExists("TestSchema", "TestTable2", "Name2").ShouldBeTrue();

                    runner.Down(new TestCreateAndDropTableMigrationWithSchema());

                    runner.Down(new TestCreateSchema());
                }, true, new[] { typeof(SQLiteProcessor), typeof(FirebirdProcessor), typeof(SqlAnywhereProcessor) });
        }

        [Test]
        [Category("MySql")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        [Category("SqlAnywhere16")]
        public void CanAlterTableWithSchema()
        {
            ExecuteWithSupportedProcessors(
                processor =>
                {
                    var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);

                    runner.Up(new TestCreateSchema());

                    runner.Up(new TestCreateAndDropTableMigrationWithSchema());
                    processor.ColumnExists("TestSchema", "TestTable2", "NewColumn").ShouldBeFalse();

                    runner.Up(new TestAlterTableWithSchema());
                    processor.ColumnExists("TestSchema", "TestTable2", "NewColumn").ShouldBeTrue();

                    runner.Down(new TestAlterTableWithSchema());
                    processor.ColumnExists("TestSchema", "TestTable2", "NewColumn").ShouldBeFalse();

                    runner.Down(new TestCreateAndDropTableMigrationWithSchema());

                    runner.Down(new TestCreateSchema());
                }, true, new[] { typeof(SQLiteProcessor), typeof(FirebirdProcessor) });
        }

        [Test]
        [Category("MySql")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        public void CanAlterTablesSchema()
        {
            ExecuteWithSupportedProcessors(
                processor =>
                {
                    var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);

                    runner.Up(new TestCreateSchema());

                    runner.Up(new TestCreateAndDropTableMigrationWithSchema());
                    processor.TableExists("TestSchema", "TestTable").ShouldBeTrue();

                    runner.Up(new TestAlterSchema());
                    processor.TableExists("NewSchema", "TestTable").ShouldBeTrue();

                    runner.Down(new TestAlterSchema());
                    processor.TableExists("TestSchema", "TestTable").ShouldBeTrue();

                    runner.Down(new TestCreateAndDropTableMigrationWithSchema());

                    runner.Down(new TestCreateSchema());
                }, true, new[] { typeof(SQLiteProcessor), typeof(FirebirdProcessor), typeof(SqlAnywhereProcessor) });
        }

        [Test]
        [Category("Firebird")]
        [Category("MySql")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        public void CanCreateUniqueConstraint()
        {
            ExecuteWithSupportedProcessors(
                processor =>
                {
                    var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);

                    runner.Up(new TestCreateAndDropTableMigration());
                    processor.ConstraintExists(null, "TestTable2", "TestUnique").ShouldBeFalse();

                    runner.Up(new TestCreateUniqueConstraint());
                    processor.ConstraintExists(null, "TestTable2", "TestUnique").ShouldBeTrue();

                    runner.Down(new TestCreateUniqueConstraint());
                    processor.ConstraintExists(null, "TestTable2", "TestUnique").ShouldBeFalse();

                    runner.Down(new TestCreateAndDropTableMigration());

                }, true, typeof(SQLiteProcessor), typeof(SqlAnywhereProcessor));
        }

        [Test]
        [Category("MySql")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        public void CanCreateUniqueConstraintWithSchema()
        {
            ExecuteWithSupportedProcessors(
                processor =>
                {
                    var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);

                    runner.Up(new TestCreateSchema());

                    runner.Up(new TestCreateAndDropTableMigrationWithSchema());
                    processor.ConstraintExists("TestSchema", "TestTable2", "TestUnique").ShouldBeFalse();

                    runner.Up(new TestCreateUniqueConstraintWithSchema());
                    processor.ConstraintExists("TestSchema", "TestTable2", "TestUnique").ShouldBeTrue();

                    runner.Down(new TestCreateUniqueConstraintWithSchema());
                    processor.ConstraintExists("TestSchema", "TestTable2", "TestUnique").ShouldBeFalse();

                    runner.Down(new TestCreateAndDropTableMigrationWithSchema());

                    runner.Down(new TestCreateSchema());
                }, true, new[] { typeof(SQLiteProcessor), typeof(FirebirdProcessor), typeof(SqlAnywhereProcessor) });
        }

        [Test]
        [Category("Firebird")]
        [Category("MySql")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        [Category("SqlAnywhere16")]
        public void CanInsertData()
        {
            ExecuteWithSupportedProcessors(
                processor =>
                {
                    var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);

                    runner.Up(new TestCreateAndDropTableMigration());
                    DataSet ds = processor.ReadTableData(null, "TestTable");
                    ds.Tables[0].Rows.Count.ShouldBe(1);
                    ds.Tables[0].Rows[0][1].ShouldBe("Test");

                    runner.Down(new TestCreateAndDropTableMigration());

                }, true, new[] { typeof(SQLiteProcessor) });
        }

        [Test]
        [Category("MySql")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        [Category("SqlAnywhere16")]
        public void CanInsertDataWithSchema()
        {
            ExecuteWithSupportedProcessors(
                processor =>
                {
                    var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);

                    runner.Up(new TestCreateSchema());

                    runner.Up(new TestCreateAndDropTableMigrationWithSchema());
                    DataSet ds = processor.ReadTableData("TestSchema", "TestTable");
                    ds.Tables[0].Rows.Count.ShouldBe(1);
                    ds.Tables[0].Rows[0][1].ShouldBe("Test");

                    runner.Down(new TestCreateAndDropTableMigrationWithSchema());

                    runner.Down(new TestCreateSchema());
                }, true, new[] { typeof(SQLiteProcessor), typeof(FirebirdProcessor) });
        }

        [Test]
        [Category("MySql")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        [Category("SqlAnywhere16")]
        public void CanUpdateData()
        {
            ExecuteWithSupportedProcessors(
                processor =>
                {
                    var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);

                    runner.Up(new TestCreateSchema());

                    runner.Up(new TestCreateAndDropTableMigrationWithSchema());

                    runner.Up(new TestUpdateData());
                    DataSet upDs = processor.ReadTableData("TestSchema", "TestTable");
                    upDs.Tables[0].Rows.Count.ShouldBe(1);
                    upDs.Tables[0].Rows[0][1].ShouldBe("Updated");

                    runner.Down(new TestUpdateData());
                    DataSet downDs = processor.ReadTableData("TestSchema", "TestTable");
                    downDs.Tables[0].Rows.Count.ShouldBe(1);
                    downDs.Tables[0].Rows[0][1].ShouldBe("Test");

                    runner.Down(new TestCreateAndDropTableMigrationWithSchema());

                    runner.Down(new TestCreateSchema());
                }, true, new[] { typeof(SQLiteProcessor), typeof(FirebirdProcessor) });
        }

        [Test]
        [Category("Firebird")]
        [Category("MySql")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        [Category("SqlAnywhere16")]
        public void CanDeleteData()
        {
            ExecuteWithSupportedProcessors(
                processor =>
                {
                    var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);

                    runner.Up(new TestCreateAndDropTableMigration());

                    runner.Up(new TestDeleteData());
                    DataSet upDs = processor.ReadTableData(null, "TestTable");
                    upDs.Tables[0].Rows.Count.ShouldBe(0);

                    runner.Down(new TestDeleteData());
                    DataSet downDs = processor.ReadTableData(null, "TestTable");
                    downDs.Tables[0].Rows.Count.ShouldBe(1);
                    downDs.Tables[0].Rows[0][1].ShouldBe("Test");

                    runner.Down(new TestCreateAndDropTableMigration());

                }, true, new[] { typeof(SQLiteProcessor) });
        }

        [Test]
        [Category("MySql")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        [Category("SqlAnywhere16")]
        public void CanDeleteDataWithSchema()
        {
            ExecuteWithSupportedProcessors(
                processor =>
                {
                    var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);

                    runner.Up(new TestCreateSchema());

                    runner.Up(new TestCreateAndDropTableMigrationWithSchema());

                    runner.Up(new TestDeleteDataWithSchema());
                    DataSet upDs = processor.ReadTableData("TestSchema", "TestTable");
                    upDs.Tables[0].Rows.Count.ShouldBe(0);

                    runner.Down(new TestDeleteDataWithSchema());
                    DataSet downDs = processor.ReadTableData("TestSchema", "TestTable");
                    downDs.Tables[0].Rows.Count.ShouldBe(1);
                    downDs.Tables[0].Rows[0][1].ShouldBe("Test");

                    runner.Down(new TestCreateAndDropTableMigrationWithSchema());

                    runner.Down(new TestCreateSchema());
                }, true, new[] { typeof(SQLiteProcessor), typeof(FirebirdProcessor) });
        }

        [Test]
        [Category("Firebird")]
        [Category("MySql")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        [Category("SqlAnywhere16")]
        public void CanReverseCreateIndex()
        {
            ExecuteWithSupportedProcessors(
                processor =>
                {
                    var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);

                    runner.Up(new TestCreateSchema());

                    runner.Up(new TestCreateAndDropTableMigrationWithSchema());

                    runner.Up(new TestCreateIndexWithReversing());
                    processor.IndexExists("TestSchema", "TestTable2", "IX_TestTable2_Name2").ShouldBeTrue();

                    runner.Down(new TestCreateIndexWithReversing());
                    processor.IndexExists("TestSchema", "TestTable2", "IX_TestTable2_Name2").ShouldBeFalse();

                    runner.Down(new TestCreateAndDropTableMigrationWithSchema());

                    runner.Down(new TestCreateSchema());
                }, true, new[] { typeof(SQLiteProcessor) });
        }

        [Test]
        [Category("Firebird")]
        [Category("MySql")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        public void CanReverseCreateUniqueConstraint()
        {
            ExecuteWithSupportedProcessors(
                processor =>
                {
                    var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);

                    runner.Up(new TestCreateAndDropTableMigration());

                    runner.Up(new TestCreateUniqueConstraintWithReversing());
                    processor.ConstraintExists(null, "TestTable2", "TestUnique").ShouldBeTrue();

                    runner.Down(new TestCreateUniqueConstraintWithReversing());
                    processor.ConstraintExists(null, "TestTable2", "TestUnique").ShouldBeFalse();

                    runner.Down(new TestCreateAndDropTableMigration());

                }, true, new[] { typeof(SQLiteProcessor), typeof(SqlAnywhereProcessor) });
        }

        [Test]
        [Category("Firebird")]
        [Category("MySql")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        public void CanReverseCreateUniqueConstraintWithSchema()
        {
            ExecuteWithSupportedProcessors(
                processor =>
                {
                    var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);

                    runner.Up(new TestCreateSchema());

                    runner.Up(new TestCreateAndDropTableMigrationWithSchema());

                    runner.Up(new TestCreateUniqueConstraintWithSchemaWithReversing());
                    processor.ConstraintExists("TestSchema", "TestTable2", "TestUnique").ShouldBeTrue();

                    runner.Down(new TestCreateUniqueConstraintWithSchemaWithReversing());
                    processor.ConstraintExists("TestSchema", "TestTable2", "TestUnique").ShouldBeFalse();

                    runner.Down(new TestCreateAndDropTableMigrationWithSchema());

                    runner.Down(new TestCreateSchema());

                }, true, new[] { typeof(SQLiteProcessor), typeof(SqlAnywhereProcessor) });
        }

        [Test]
        [Category("MySql")]
        [Category("SQLite")]
        [Category("Postgres")]
        [Category("SqlServer2005")]
        [Category("SqlServer2008")]
        [Category("SqlServer2012")]
        [Category("SqlServer2014")]
        [Category("SqlServer2016")]
        [Category("SqlAnywhere16")]
        public void CanExecuteSql()
        {
            ExecuteWithSupportedProcessors(
                processor =>
                {
                    var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);

                    runner.Up(new TestExecuteSql());
                    runner.Down(new TestExecuteSql());

                }, true, new[] { typeof(FirebirdProcessor) });
        }

        private static MigrationRunner SetupMigrationRunner(IMigrationProcessor processor)
        {
            Assembly asm = typeof(MigrationRunnerTests).Assembly;
            var runnerContext = new RunnerContext(new TextWriterAnnouncer(TestContext.Out))
            {
                Namespace = "FluentMigrator.Tests.Integration.Migrations",
                AllowBreakingChange = true,
            };

            return new MigrationRunner(asm, runnerContext, processor);
        }

        private static void CleanupTestSqlServerDatabase(SqlConnection connection, SqlServerProcessor origProcessor)
        {
            if (origProcessor.WasCommitted)
            {
                connection.Close();

                var dbTypes = new List<string>
                {
                    origProcessor.DatabaseType
                };
                dbTypes.AddRange(origProcessor.DatabaseTypeAliases);

                var cleanupProcessor = new SqlServerProcessor(dbTypes, connection, new SqlServer2008Generator(), new TextWriterAnnouncer(TestContext.Out), new ProcessorOptions(), new SqlServerDbFactory());
                MigrationRunner cleanupRunner = SetupMigrationRunner(cleanupProcessor);
                cleanupRunner.RollbackToVersion(0);

            }
            else
            {
                origProcessor.RollbackTransaction();
            }
        }
    }
}


text:
package io.requery.android.sqlite;

import android.database.sqlite.SQLiteCursor;
import android.database.sqlite.SQLiteStatement;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * {@link java.sql.PreparedStatement} implementation using Android's local SQLite database.
 */
class SqlitePreparedStatement extends BasePreparedStatement {

    private final SqliteConnection connection;
    private final SQLiteStatement statement;
    private SQLiteCursor cursor;

    SqlitePreparedStatement(SqliteConnection connection, String sql, int autoGeneratedKeys)
        throws SQLException {
        super(connection, sql, autoGeneratedKeys);
        this.connection = connection;
        statement = connection.getDatabase().compileStatement(sql);
    }

    @Override
    protected void bindNullOrString(int index, Object value) {
        if (value == null) {
            statement.bindNull(index);
            if (bindings != null) {
                bindings.add(null);
            }
        } else {
            String string = value.toString();
            statement.bindString(index, string);
            if (bindings != null) {
                bindings.add(string);
            }
        }
    }

    @Override
    protected void bindLong(int index, long value) {
        statement.bindLong(index, value);
        if (bindings != null) {
            bindings.add(value);
        }
    }

    @Override
    protected void bindDouble(int index, double value) {
        statement.bindDouble(index, value);
        if (bindings != null) {
            bindings.add(value);
        }
    }

    @Override
    protected void bindBlob(int index, byte[] value) {
        if (value == null) {
            statement.bindNull(index);
            if (bindings != null) {
                bindings.add(null);
            }
        } else {
            statement.bindBlob(index, value);
            if (bindings != null) {
                bindBlobLiteral(index, value);
            }
        }
    }

    @Override
    public void close() throws SQLException {
        clearParameters();
        statement.close();
        if (cursor != null) {
            cursor.close();
        }
        super.close();
    }

    @Override
    public boolean execute(String sql, int autoGeneratedKeys) throws SQLException {
        throw new UnsupportedOperationException();
    }

    @Override
    public ResultSet executeQuery(String sql) throws SQLException {
        throw new UnsupportedOperationException();
    }

    @Override
    public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException {
        throw new UnsupportedOperationException();
    }

    @Override
    public void clearParameters() throws SQLException {
        throwIfClosed();
        statement.clearBindings();
        if (bindings != null) {
            bindings.clear();
        }
    }

    @Override
    public boolean execute() throws SQLException {
        throwIfClosed();
        try {
            statement.execute();
        } catch (android.database.SQLException e) {
            SqliteConnection.throwSQLException(e);
        }
        return false;
    }

    @Override
    public ResultSet executeQuery() throws SQLException {
        throwIfClosed();
        try {
            String[] args = bindingsToArray();
            if (cursor != null) {
                cursor.setSelectionArguments(args);
                if (!cursor.requery()) {
                    cursor.close();
                    cursor = null; // close/set to null try to recreate it
                }
            }
            if (cursor == null) {
                cursor = (SQLiteCursor) connection.getDatabase().rawQuery(sql, args);
            }
            return queryResult = new CursorResultSet(this, cursor, false);
        } catch (android.database.SQLException e) {
            SqliteConnection.throwSQLException(e);
        }
        return null;
    }

    @Override
    public int executeUpdate() throws SQLException {
        throwIfClosed();
        if (autoGeneratedKeys == RETURN_GENERATED_KEYS) {
            try {
                long rowId = statement.executeInsert();
                insertResult = new SingleResultSet(this, rowId);
                updateCount = 1;
            } catch (android.database.SQLException e) {
                SqliteConnection.throwSQLException(e);
            }
        } else {
            try {
                updateCount = statement.executeUpdateDelete();
            } catch (android.database.SQLException e) {
                SqliteConnection.throwSQLException(e);
            }
        }
        return updateCount;
    }
}


text:
#ifndef HALFEDGE_HPP
#define HALFEDGE_HPP

// warpit namespace
namespace warpit {

    // Halfedge data structure.
    class Halfedge
    {
    public:
        // Constructor.
        Halfedge() : prev(-1), next(-1), neigh(-1), dest(-1) { }

        // Flags.
        int prev;  // index of the previous halfedge
        int next;  // index of the next halfedge
        int neigh; // the neighboring halfedge
        int dest;  // index of the vertex at the end of the halfedge
    };

} // namespace warpit

#endif // HALFEDGE_HPP


text:
package com.camnter.newlife.ui.activity;

import android.os.Bundle;
import android.view.View;
import com.camnter.newlife.R;
import com.camnter.newlife.core.activity.BaseAppCompatActivity;
import com.camnter.newlife.utils.otto.BusProvider;
import com.camnter.otto.Produce;
import com.camnter.otto.Subscribe;
import com.camnter.utils.ToastUtils;

/**
 * Description:OttoActivity
 * Created by:CaMnter
 * Time:2016-01-24 18:18
 */
public class OttoActivity extends BaseAppCompatActivity implements View.OnClickListener {

    /**
     * Called when a view has been clicked.
     *
     * @param v The view that was clicked.
     */
    @Override public void onClick(View v) {
        switch (v.getId()) {
            case R.id.otto_send:
                BusProvider.getInstance().post(new OttoEvent("TextView"));
                break;
        }
    }

    @Override protected void onResume() {
        super.onResume();
        BusProvider.getInstance().register(this);
    }

    /**
     * Dispatch onPause() to fragments.
     */
    @Override protected void onPause() {
        super.onPause();
        BusProvider.getInstance().unregister(this);
    }

    /**
     * 订阅事件
     *
     * @param event event
     */
    @Subscribe public void hello(OttoEvent event) {
        ToastUtils.show(this, event.toString() +
            "\thello", ToastUtils.LENGTH_SHORT);
    }

    /**
     * 产生事件
     *
     * @return OttoEvent
     */
    @Produce public OttoEvent produceBySelf() {
        return new OttoEvent("Self");
    }

    /**
     * Fill in layout id
     *
     * @return layout id
     */
    @Override protected int getLayoutId() {
        return R.layout.activity_otto;
    }

    /**
     * Initialize the view in the layout
     *
     * @param savedInstanceState savedInstanceState
     */
    @Override protected void initViews(Bundle savedInstanceState) {

    }

    /**
     * Initialize the View of the listener
     */
    @Override protected void initListeners() {
        this.findViewById(R.id.otto_send).setOnClickListener(this);
    }

    /**
     * Initialize the Activity data
     */
    @Override protected void initData() {

    }

    private class OttoEvent {
        // No instances.
        private String msg;

        public OttoEvent(String msg) {
            this.msg = msg;
        }

        @Override public String toString() {
            return "OttoEvent{" +
                "msg='" + msg + '\'' +
                '}';
        }
    }

}