Kiln Harmony allows you to access any of your repositories using both Git and Mercurial.
if (Model.Vcs == Vcs.Both) {You can view commits in this repository with Git or Mercurial metadata:
}Mercurial and Git clients can push and pull from this alias URL to interact with this repository. You can change to which repository an alias points by going to the Aliases link on the project page.
Editing this file at revision 405057187903 will create a new head. Would you like to still edit at tip?
|
#region License
//The contents of this file are subject to the Mozilla Public License
//Version 1.1 (the "License"); you may not use this file except in
//compliance with the License. You may obtain a copy of the License at
//http://www.mozilla.org/MPL/
//Software distributed under the License is distributed on an "AS IS"
//basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
//License for the specific language governing rights and limitations
//under the License.
#endregion
using System;
using System.Collections;
using NUnit.Framework;
using NMock;
using Migrator.Providers;
using Migrator.Providers.Tests;
namespace Migrator.Tests
{
[TestFixture]
public class MigratorTest
{
private Migrator _migrator;
private TransformationProvider _provider;
// Collections qui vont contenir les # de versions
// des migrations invoqu�es apr�s un appel au migrateur.
public static ArrayList _upCalled = new ArrayList();
public static ArrayList _downCalled = new ArrayList();
[SetUp]
public void SetUp()
{
_provider = new SqlServerTransformationProvider("");
_migrator = new Migrator(_provider, typeof(FirstMigration).Assembly, true);
_upCalled.Clear();
_downCalled.Clear();
SetUpCurrentVersion(0);
}
[Test]
public void MigrateUpward()
{
SetUpCurrentVersion(1);
_migrator.MigrateTo(3);
Assert.AreEqual(3, _migrator.LatestVersion);
Assert.AreEqual(2, _upCalled.Count);
Assert.AreEqual(0, _downCalled.Count);
Assert.AreEqual(2, _upCalled[0]);
Assert.AreEqual(3, _upCalled[1]);
}
[Test]
public void MigrateBackward()
{
SetUpCurrentVersion(3);
_migrator.MigrateTo(1);
Assert.AreEqual(0, _upCalled.Count);
Assert.AreEqual(2, _downCalled.Count);
Assert.AreEqual(3, _downCalled[0]);
Assert.AreEqual(2, _downCalled[1]);
}
[Test]
public void MigrateUpwardWithRollback()
{
SetUpCurrentVersion(3);
try
{
_migrator.MigrateTo(6);
Assert.Fail("La migration 5 devrait lancer une exception");
}
catch (Exception) {}
Assert.AreEqual(1, _upCalled.Count);
Assert.AreEqual(0, _downCalled.Count);
Assert.AreEqual(4, _upCalled[0]);
}
[Test]
public void MigrateDownwardWithRollback()
{
SetUpCurrentVersion(6);
try
{
_migrator.MigrateTo(3);
Assert.Fail("La migration 5 devrait lancer une exception");
}
catch (Exception) {}
Assert.AreEqual(0, _upCalled.Count);
Assert.AreEqual(1, _downCalled.Count);
Assert.AreEqual(6, _downCalled[0]);
}
[Test]
public void MigrateToCurrentVersion()
{
SetUpCurrentVersion(3);
_migrator.MigrateTo(3);
Assert.AreEqual(0, _upCalled.Count);
Assert.AreEqual(0, _downCalled.Count);
}
[Test]
public void LastVersion()
{
Assert.AreEqual(6, _migrator.LastVersion);
}
[Test]
public void CurrentVersion()
{
SetUpCurrentVersion(4);
Assert.AreEqual(4, _migrator.LatestVersion);
SetUpCurrentVersion(1);
Assert.AreEqual(1, _migrator.LatestVersion);
}
[Test]
[ExpectedException(typeof(DuplicatedVersionException))]
public void CheckForDuplicatedVersion()
{
_migrator.MigrationsTypes.Add(typeof(FirstMigration));
_migrator.CheckForDuplicatedVersion();
}
#region Helper methods and classes
private void SetUpCurrentVersion(int version)
{
if(_provider == null)
_provider = new SqlServerTransformationProvider("");
}
#endregion
}
[Migration(1, Ignore = false)]
public class FirstMigration : AbstractTestMigration { }
[Migration(2, Ignore = false)]
public class SecondMigration : AbstractTestMigration { }
[Migration(3, Ignore = false)]
public class ThirdMigration : AbstractTestMigration { }
[Migration(4, Ignore = false)]
public class ForthMigration : AbstractTestMigration { }
[Migration(5, Ignore = false)]
public class BadMigration : AbstractTestMigration
{
override public void Up()
{
throw new Exception("oh uh!");
}
override public void Down()
{
throw new Exception("oh uh!");
}
}
[Migration(6, Ignore = false)]
public class SixthMigration : AbstractTestMigration { }
public class AbstractTestMigration : Migration
{
override public void Up()
{
MigratorTest._upCalled.Add(Migrator.GetMigrationVersion(GetType()));
}
override public void Down()
{
MigratorTest._downCalled.Add(Migrator.GetMigrationVersion(GetType()));
}
}
}
|
You are no longer logged in. Please log in and try your request again.
This RSS feed URL allows you to see the contents of your current filter using any feed reader.
This link includes a special authentication token. If you share the URL with anyone else, they can see this RSS feed's activity. You can disable these tokens when needed.
Your current filter is unsaved; changing it won't affect this RSS feed.
Loading...