Example #1
0
        public void TestPropFileUpdate()
        {
            string msiPath = Path.Combine(Environment.CurrentDirectory, "Assets", "msi.swr");
            PropsFileVariableReference variable = new PropsFileVariableReference("WindowsDesktopSharedFramework31Version", "3.3.3", msiPath);

            PropsFileUpdater   propsUpdater = new PropsFileUpdater();
            PropsUpdateResults?results      = propsUpdater.UpdatePropsFiles(Enumerable.Repeat(variable, 1), Environment.CurrentDirectory);

            Assert.IsNotNull(results);
            Assert.IsTrue(results.Outcome);

            if (results.UnrecognizedVariables != null)
            {
                Assert.AreEqual(0, results.UnrecognizedVariables.Count, "Variable was not recognized.");
            }

            Assert.IsNotNull(results.UpdatedVariables);
            Assert.AreEqual(1, results.UpdatedVariables.Count);
            Assert.IsTrue(results.UpdatedVariables.First().Value.Contains(variable), "Supplied variable is not among the updated.");

            Assert.IsNotNull(results.ModifiedFiles, "No props file was updated.");
            Assert.AreEqual(1, results.ModifiedFiles.Count, "No props file was updated.");
            Assert.IsTrue(results.ModifiedFiles[0].Succeeded);
            Assert.IsNull(results.ModifiedFiles[0].Exception);
            Assert.AreEqual("dotNetCoreVersions.props", Path.GetFileName(results.ModifiedFiles[0].Path));
        }
Example #2
0
        public void TestPropsFileScope()
        {
            // swr is in the root folder while props file will be in a child folder.
            string msiPath = Path.Combine(Environment.CurrentDirectory, "msi.swr");
            PropsFileVariableReference variable = new PropsFileVariableReference("WindowsDesktopSharedFramework31Version", "3.3.3", msiPath);

            PropsFileUpdater   propsUpdater = new PropsFileUpdater();
            PropsUpdateResults?results      = propsUpdater.UpdatePropsFiles(Enumerable.Repeat(variable, 1), Environment.CurrentDirectory);

            Assert.IsNotNull(results);
            Assert.IsTrue(results.Outcome);

            Assert.IsNotNull(results.UnrecognizedVariables);
            Assert.AreEqual(1, results.UnrecognizedVariables.Count);
            Assert.AreEqual(variable.Name, results.UnrecognizedVariables[0].Name);

            Assert.AreEqual(0, results.UpdatedVariables.Count);
            Assert.AreEqual(0, results.ModifiedFiles.Count);
        }