Пример #1
0
        public void Project_ToJson_Success(string relativePath, int referenceCount, int compileCount, string projectName)
        {
            var path    = GetResourcePath(relativePath);
            var project = ProjectHelpers.LoadProject(path, new Dictionary <string, string>());
            var json    = Jsonify.ToJson(project);

            Assert.AreEqual(referenceCount, json[projectName]["Reference"].Count());
            Assert.AreEqual(compileCount, json[projectName]["Compile"].Count());
            Assert.AreEqual(projectName, json[projectName]["Properties"]["MSBuildProjectName"].Value <String>());
        }
Пример #2
0
        public void Project_Parameters_AreApplied()
        {
            var path = GetResourcePath("Resources/dummy.csproj");
            var args = new Dictionary <string, string>();

            args["Configuration"] = "Release";
            var project = ProjectHelpers.LoadProject(path, args);
            var json    = Jsonify.ToJson(project);

            Assert.AreEqual("Release", json["dummy"]["Properties"]["Configuration"].Value <String>());
        }
Пример #3
0
        public void Solution_Parameters_AreApplied()
        {
            var path = GetResourcePath("Resources/dummy.sln");
            var args = new Dictionary <string, string>();

            args["Configuration"] = "Release";
            args["Platform"]      = "x86";
            var projects = ProjectHelpers.GetProjects(SolutionFile.Parse(path), args);
            var json     = Jsonify.ToJson(projects);

            Assert.AreEqual("Release", json["dummy"]["Properties"]["Configuration"].Value <String>());
            Assert.AreEqual("AnyCPU", json["dummy"]["Properties"]["Platform"].Value <String>());
        }
Пример #4
0
        public void Solution_ToJson_Success(string relativePath, string[] projects)
        {
            var          path     = GetResourcePath(relativePath);
            SolutionFile solution = SolutionFile.Parse(path);

            var json = Jsonify.ToJson(ProjectHelpers.GetProjects(solution, new Dictionary <string, string>()));
            int i    = 0;

            foreach (var project in json)
            {
                Assert.AreEqual(projects[i++], project.Key);
            }
        }
Пример #5
0
        public void Project_NugetDependencies_AreParsed()
        {
            var path = GetResourcePath("Resources/dummy.csproj");
            var args = new Dictionary <string, string>();

            args["Configuration"] = "Release";
            var project = ProjectHelpers.LoadProject(path, args);
            var json    = Jsonify.ToJson(project);

            var dependencies = ((JArray)json["dummy"]["NugetDependencies"]);

            Assert.AreEqual(5, dependencies.Count);
            AssertDependency(dependencies, 0, "Microsoft.Web.Xdt", "2.1.1");
            AssertDependency(dependencies, 1, "MSBuild", "0.1.2");
            AssertDependency(dependencies, 2, "Newtonsoft.Json", "8.0.2");
            AssertDependency(dependencies, 3, "NuGet.Core", "2.14.0");
            AssertDependency(dependencies, 4, "FooBar", "0.2.3.0-gerrit96533-SNAPSHOT", true);
        }