public void GetSources_WhenRestoreSourcesSpecified_CorrectSourcesDetected() { var project = new MockMSBuildProject(new Dictionary <string, string> { ["RestoreSources"] = "https://source1;https://source2" }); var settings = new MockSettings { Sections = new List <SettingSection> { new MockSettingSection(ConfigurationConstants.PackageSources, new ClearItem(), new AddItem("source3", "https://source3")) } }; var actual = MSBuildStaticGraphRestore.GetSources(project, new[] { project }, settings); actual.ShouldBeEquivalentTo(new[] { new PackageSource("https://source1"), new PackageSource("https://source2"), }); }
public void GetSources_WhenPerTargetFrameworkSources_CorrectSourcesDetected() { var project = new MockMSBuildProject(new Dictionary <string, string> { ["RestoreSources"] = "https://source1", }); var projectsByTargetFramework = new List <IMSBuildProject> { new MockMSBuildProject(new Dictionary <string, string> { ["RestoreAdditionalProjectSources"] = "https://source2", }), new MockMSBuildProject(new Dictionary <string, string> { ["RestoreAdditionalProjectSources"] = "https://source3;https://source4", }), }; var settings = new MockSettings { Sections = new List <SettingSection> { new MockSettingSection(ConfigurationConstants.PackageSources, new AddItem("source4", "https://source2")) } }; var actual = MSBuildStaticGraphRestore.GetSources(project, projectsByTargetFramework, settings); actual.ShouldBeEquivalentTo(new[] { new PackageSource("https://source1"), new PackageSource("https://source2"), new PackageSource("https://source3"), new PackageSource("https://source4"), }); }