public void LoadXmlPresent() { string upfilePath = Helper.PathCombine("TestData", "UpfileTest", "Upfile.xml"); Upfile parsed = Upfile.LoadXml(upfilePath); Assert.IsTrue(parsed.Dependencies.Any(dep => string.Equals(dep.Name, "test_package")), "No correct dependency found"); Assert.IsTrue(parsed.Repositories.Any(repo => repo is FileRepository && string.Equals((repo as FileRepository).Path, Helper.PathCombine("Path", "To", "Some", "Repository"))), "No correct repository found"); }
public void LoadAbsentOverrideTest() { string upfilePath = Helper.PathCombine("TestData", "UpfileTest", "Upfile.xml"); string upfileOverridePath = Helper.PathCombine("TestData", "UpfileTest", "NoUpfileInIt", "UpfileOverride.xml"); Upfile upfile = Upfile.LoadXml(upfilePath); upfile.LoadOverrides(upfileOverridePath); Assert.IsTrue(upfile.Repositories.Any(repo => repo is FileRepository && string.Equals((repo as FileRepository).Path, Helper.PathCombine("Path", "To", "Some", "Repository"))), "Original repository not found"); Assert.IsFalse(upfile.Repositories.Any(repo => repo is FileRepository && string.Equals((repo as FileRepository).Path, Helper.PathCombine("Path", "To", "Another", "Repository"))), "Loaded absent file"); }
public void LoadPresentOverrideTest() { string upfilePath = Helper.PathCombine("TestData", "UpfileTest", "Upfile.xml"); string upfileOverridePath = Helper.PathCombine("TestData", "UpfileTest", "UpliftSettings.xml"); Upfile upfile = Upfile.LoadXml(upfilePath); upfile.overridePath = upfileOverridePath; upfile.LoadOverrides(); Assert.IsTrue(upfile.Repositories.Any(repo => repo is FileRepository && string.Equals((repo as FileRepository).Path, Helper.PathCombine("Path", "To", "Some", "Repository"))), "Original repository not found"); Assert.IsTrue(upfile.Repositories.Any(repo => repo is FileRepository && string.Equals((repo as FileRepository).Path, Helper.PathCombine("Path", "To", "Another", "Repository"))), "Override repository not found"); }
public void LoadXmlPresent() { string upfilePath = string.Join(Path.DirectorySeparatorChar.ToString(), new string[] { "TestData", "UpfileTest", "Upfile.xml" }); Upfile parsed = Upfile.LoadXml(upfilePath); Assert.IsTrue(parsed.Dependencies.Any(dep => string.Equals(dep.Name, "test_package")), "No correct dependency found"); Assert.IsTrue(parsed.Repositories.Any(repo => repo is FileRepository && string.Equals((repo as FileRepository).Path, "Path\\To\\Some\\Repository")), "No correct repository found"); }
public void LoadXmlAbsent() { string upfilePath = Helper.PathCombine("TestData", "UpfileTest", "NoUpfileInIt", "Upfile.xml"); bool caught = false; try { Upfile.LoadXml(upfilePath); } catch { caught = true; } Assert.IsTrue(caught); }
public void LoadPresentOverrideTest() { string upfilePath = string.Join(Path.DirectorySeparatorChar.ToString(), new string[] { "TestData", "UpfileTest", "Upfile.xml" }); string upfileOverridePath = string.Join(Path.DirectorySeparatorChar.ToString(), new string[] { "TestData", "UpfileTest", "UpfileOverride.xml" }); Upfile upfile = Upfile.LoadXml(upfilePath); upfile.LoadOverrides(upfileOverridePath); Assert.IsTrue(upfile.Repositories.Any(repo => repo is FileRepository && string.Equals((repo as FileRepository).Path, "Path\\To\\Some\\Repository")), "Original repository not found"); Assert.IsTrue(upfile.Repositories.Any(repo => repo is FileRepository && string.Equals((repo as FileRepository).Path, "Path\\To\\Another\\Repository")), "Override repository not found"); }
public void LoadXmlAbsent() { string upfilePath = string.Join(Path.DirectorySeparatorChar.ToString(), new string[] { "TestData", "UpfileTest", "NoUpfileInIt", "Upfile.xml" }); bool caught = false; try { Upfile.LoadXml(upfilePath); } catch { caught = true; } Assert.IsTrue(caught); }