public void GetProjectTargetFrameworks_WhenMultipleTargetFrameworks_CorrectTargetFrameworkDetected()
        {
            using (var testDirectory = TestDirectory.Create())
            {
                var project = new MockMSBuildProject(testDirectory, new Dictionary <string, string>
                {
                    ["TargetFrameworks"] = "net45;netstandard2.0"
                });

                var innerNodes = new Dictionary <string, IMSBuildProject>
                {
                    ["net45"]          = new MockMSBuildProject("Project-net45"),
                    ["net46"]          = new MockMSBuildProject("Project-net46"),
                    ["netstandard2.0"] = new MockMSBuildProject("Project-netstandard2.0"),
                };

                var actual = MSBuildStaticGraphRestore.GetProjectTargetFrameworks(project, innerNodes);

                actual.Keys.ShouldBeEquivalentTo(
                    new[]
                {
                    FrameworkConstants.CommonFrameworks.Net45,
                    FrameworkConstants.CommonFrameworks.NetStandard20
                });

                actual.Values.Select(i => i.FullPath).ShouldBeEquivalentTo(
                    new[]
                {
                    "Project-net45",
                    "Project-netstandard2.0"
                });
            }
        }
        public void GetProjectTargetFrameworks_WhenLegacyCsproj_CorrectTargetFrameworkDetected()
        {
            using (var testDirectory = TestDirectory.Create())
            {
                var project = new MockMSBuildProject(testDirectory, new Dictionary <string, string>
                {
                    ["TargetFrameworkMoniker"] = ".NETFramework,Version=v4.6.1"
                });

                var innerNodes = new Dictionary <string, IMSBuildProject>();

                var actual = MSBuildStaticGraphRestore.GetProjectTargetFrameworks(project, innerNodes)
                             .Should().ContainSingle();

                actual.Subject.Key.Should().Be(string.Empty);
                actual.Subject.Value.FullPath.Should().Be(project.FullPath);
            }
        }
        public void GetProjectTargetFrameworks_WhenSingleTargetFramework_CorrectTargetFrameworkDetected()
        {
            using (var testDirectory = TestDirectory.Create())
            {
                var project = new MockMSBuildProject(testDirectory, new Dictionary <string, string>
                {
                    ["TargetFramework"] = "net45",
                });

                var innerNodes = new Dictionary <string, IMSBuildProject>
                {
                    ["net45"]          = new MockMSBuildProject("Project-net45"),
                    ["net46"]          = new MockMSBuildProject("Project-net46"),
                    ["netstandard2.0"] = new MockMSBuildProject("Project-netstandard2.0"),
                };

                var actual = MSBuildStaticGraphRestore.GetProjectTargetFrameworks(project, innerNodes);

                actual.Should().ContainSingle()
                .Which.Value.FullPath.Should().Be("Project-net45");
            }
        }