public void GetFileVersion_FileHasNoVersionUsingDefaultStrategy_ReturnsZero()
		{
			using (var e = new EnvironmentForTest())
			{
				e.WriteTestFile(EnvironmentForTest.XmlNoVersion);

				var migrator = new FileMigrator(1, e.TestFilePath);
				migrator.AddVersionStrategy(new XPathVersion(1, "/configuration/@version"));
				migrator.AddVersionStrategy(new DefaultVersion(0, 0));

				Assert.AreEqual(0, migrator.GetFileVersion(e.TestFilePath));
			}
		}
		public void GetFileVersion_FileHasNoVersionAndNoDefaultStrategy_Throws()
		{
			using (var e = new EnvironmentForTest())
			{
				e.WriteTestFile(EnvironmentForTest.XmlNoVersion);

				var migrator = new FileMigrator(1, e.TestFilePath);
				migrator.AddVersionStrategy(new XPathVersion(1, "/configuration/@version"));

				Assert.Throws<ApplicationException>(
					() => migrator.GetFileVersion(e.TestFilePath)
				);
			}
		}
		public void FileVersion_TwoStragiesSort_UsesHigherStrategyFirst()
		{
			var migrator = new FileMigrator(10, "somefile");
			migrator.AddVersionStrategy(new VersionStrategyThatThrows(2));
			migrator.AddVersionStrategy(new VersionStrategyThatsGood(8, 10));
			Assert.That(migrator.GetFileVersion(), Is.EqualTo(8));
		}
		public void GetFileVersion_DataHasVersion_CorrectVersion()
		{
			using (var e = new EnvironmentForTest())
			{
				e.WriteTestFile(EnvironmentForTest.XmlVersion1);

				var migrator = new FileMigrator(7, e.TestFilePath);
				migrator.AddVersionStrategy(new XPathVersion(1, "/configuration/@version"));

				Assert.AreEqual(1, migrator.GetFileVersion(e.TestFilePath));
			}
		}
		public void FileVersion_OneStrategy_Correct()
		{
			var migrator = new FileMigrator(10, "somefile");
			migrator.AddVersionStrategy(new VersionStrategyThatsGood(8, 10));
			Assert.That(migrator.GetFileVersion(), Is.EqualTo(8));
		}