Exemple #1
0
        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");
        }
Exemple #2
0
        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");
        }
Exemple #3
0
        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");
        }
Exemple #4
0
        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");
        }
Exemple #5
0
        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);
        }
Exemple #6
0
        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");
        }
Exemple #7
0
        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);
        }