public void ConsolidateInstallsVersionsToHighestExisting() { // Arrange var tracing = new TestTracing(); var sut = TestFixtureHelper.GetNuGetInstaller(true, false); var saved = new List <(string path, string content)>(); var project1 = TestFixtureHelper.CreateProject(VisualStudioProjectScheme.Lean, TestVersion.High, TestPackage.One, new Dictionary <string, string>()); var project2 = TestFixtureHelper.CreateProject(VisualStudioProjectScheme.Lean, TestVersion.High, TestPackage.Two, new Dictionary <string, string> { { "TestPackage.One", "1.0.0" } }); var projects = new[] { project1, project2 }; // Act sut.Execute(projects, tracing, (path, content) => saved.Add((path, content))); // Assert Assert.Collection(saved, nuGetProject => { Assert.Equal(project2.FilePath, nuGetProject.path); Assert.Equal( XDocument.Parse( @"<Project Sdk=""Microsoft.NET.Sdk""> <ItemGroup> <PackageReference Include=""TestPackage.One"" Version=""2.0.0"" /> <PackageReference Include=""TestPackage.Two"" Version=""2.0.0"" /> </ItemGroup> </Project>", LoadOptions.PreserveWhitespace).ToString(), nuGetProject.content); }); }
public void ConsolidatationNotTriggeredWhenVersionsAreTheSame() { // Arrange var tracing = new TestTracing(); var sut = TestFixtureHelper.GetNuGetInstaller(true, false); var projects = new[] { TestFixtureHelper.CreateProject(VisualStudioProjectScheme.Lean, TestVersion.High, TestPackage.One, new Dictionary <string, string>()), TestFixtureHelper.CreateProject(VisualStudioProjectScheme.Lean, TestVersion.High, TestPackage.One, new Dictionary <string, string>()), }; // Act sut.Execute(projects, tracing, (filePath, content) => { }); // Assert Assert.Empty(tracing.InfoEntries); }