dependabot-nuget 0.308.0 → 0.310.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (20) hide show
  1. checksums.yaml +4 -4
  2. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/NuGetUpdater.Cli.csproj +19 -0
  3. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Program.cs +5 -0
  4. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Run.cs +6 -6
  5. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/SdkProjectDiscovery.cs +6 -0
  6. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/HttpApiHandler.cs +12 -3
  7. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunWorker.cs +23 -3
  8. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/SpecialImportsConditionPatcher.cs +14 -2
  9. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/BOMHandling.cs +35 -0
  10. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/DependencyConflictResolver.cs +0 -8
  11. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/AnalyzeWorkerTests.cs +3 -3
  12. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/EndToEndTests.cs +355 -0
  13. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/RunWorkerTests.cs +703 -550
  14. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TestDiscoveryWorker.cs +3 -4
  15. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TestHttpServer.cs +16 -6
  16. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/SpecialFilePatcherTests.cs +19 -0
  17. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/BOMHandlingTests.cs +66 -0
  18. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/EOLHandlingTests.cs +227 -13
  19. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs +331 -164
  20. metadata +8 -5
@@ -690,16 +690,26 @@ public class MSBuildHelperTests : TestBase
690
690
  var projectPath = Path.Join(tempDirectory.DirectoryPath, "project.csproj");
691
691
  await File.WriteAllTextAsync(projectPath, """
692
692
  <Project Sdk="Microsoft.NET.Sdk">
693
- <PropertyGroup>
693
+ <PropertyGroup>
694
694
  <TargetFramework>net8.0</TargetFramework>
695
- </PropertyGroup>
696
- <ItemGroup>
695
+ </PropertyGroup>
696
+ <ItemGroup>
697
697
  <PackageReference Include="CS-Script.Core" Version="1.3.1" />
698
698
  <PackageReference Include="Microsoft.CodeAnalysis.Common" Version="3.4.0" />
699
699
  <PackageReference Include="Microsoft.CodeAnalysis.Scripting.Common" Version="3.4.0" />
700
- </ItemGroup>
700
+ </ItemGroup>
701
701
  </Project>
702
702
  """);
703
+ await UpdateWorkerTestBase.MockNuGetPackagesInDirectory([
704
+ // initial packages
705
+ MockNuGetPackage.CreateSimplePackage("CS-Script.Core", "1.3.1", "net8.0", [(null, [("Microsoft.CodeAnalysis.Scripting.Common", "[3.4.0]")])]),
706
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.Scripting.Common", "3.4.0", "net8.0", [(null, [("Microsoft.CodeAnalysis.Common", "[3.4.0]")])]),
707
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.Common", "3.4.0", "net8.0"),
708
+ // available packages
709
+ MockNuGetPackage.CreateSimplePackage("CS-Script.Core", "2.0.0", "net8.0", [(null, [("Microsoft.CodeAnalysis.Scripting.Common", "[3.6.0]")])]),
710
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.Scripting.Common", "3.6.0", "net8.0", [(null, [("Microsoft.CodeAnalysis.Common", "[3.6.0]")])]),
711
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.Common", "3.6.0", "net8.0")
712
+ ], tempDirectory.DirectoryPath);
703
713
 
704
714
  var dependencies = new[]
705
715
  {
@@ -723,13 +733,14 @@ public class MSBuildHelperTests : TestBase
723
733
  new TestLogger()
724
734
  );
725
735
  Assert.NotNull(resolvedDependencies);
726
- Assert.Equal(3, resolvedDependencies.Value.Length);
727
- Assert.Equal("CS-Script.Core", resolvedDependencies.Value[0].Name);
728
- Assert.Equal("2.0.0", resolvedDependencies.Value[0].Version);
729
- Assert.Equal("Microsoft.CodeAnalysis.Common", resolvedDependencies.Value[1].Name);
730
- Assert.Equal("3.6.0", resolvedDependencies.Value[1].Version);
731
- Assert.Equal("Microsoft.CodeAnalysis.Scripting.Common", resolvedDependencies.Value[2].Name);
732
- Assert.Equal("3.6.0", resolvedDependencies.Value[2].Version);
736
+ var actualResolvedDependencies = resolvedDependencies.Value.Select(d => $"{d.Name}/{d.Version}").ToArray();
737
+ var expectedResolvedDependencies = new[]
738
+ {
739
+ "CS-Script.Core/2.0.0",
740
+ "Microsoft.CodeAnalysis.Common/3.6.0",
741
+ "Microsoft.CodeAnalysis.Scripting.Common/3.6.0",
742
+ };
743
+ AssertEx.Equal(expectedResolvedDependencies, actualResolvedDependencies);
733
744
  }
734
745
 
735
746
  // Updating a dependency (Microsoft.Bcl.AsyncInterfaces) of the root package (Azure.Core) will require the root package to also update, but since the dependency is not in the existing list, we do not include it
@@ -742,14 +753,22 @@ public class MSBuildHelperTests : TestBase
742
753
  var projectPath = Path.Join(tempDirectory.DirectoryPath, "project.csproj");
743
754
  await File.WriteAllTextAsync(projectPath, """
744
755
  <Project Sdk="Microsoft.NET.Sdk">
745
- <PropertyGroup>
756
+ <PropertyGroup>
746
757
  <TargetFramework>net8.0</TargetFramework>
747
- </PropertyGroup>
748
- <ItemGroup>
758
+ </PropertyGroup>
759
+ <ItemGroup>
749
760
  <PackageReference Include="Azure.Core" Version="1.21.0" />
750
- </ItemGroup>
761
+ </ItemGroup>
751
762
  </Project>
752
763
  """);
764
+ await UpdateWorkerTestBase.MockNuGetPackagesInDirectory([
765
+ // initial packages
766
+ MockNuGetPackage.CreateSimplePackage("Azure.Core", "1.21.0", "net8.0", [(null, [("Microsoft.Bcl.AsyncInterfaces", "[1.0.0]")])]),
767
+ MockNuGetPackage.CreateSimplePackage("Microsoft.Bcl.AsyncInterfaces", "1.0.0", "net8.0"),
768
+ // available packages
769
+ MockNuGetPackage.CreateSimplePackage("Azure.Core", "1.22.0", "net8.0", [(null, [("Microsoft.Bcl.AsyncInterfaces", "[1.1.1]")])]),
770
+ MockNuGetPackage.CreateSimplePackage("Microsoft.Bcl.AsyncInterfaces", "1.1.1", "net8.0")
771
+ ], tempDirectory.DirectoryPath);
753
772
 
754
773
  var dependencies = new[]
755
774
  {
@@ -770,9 +789,12 @@ public class MSBuildHelperTests : TestBase
770
789
  new TestLogger()
771
790
  );
772
791
  Assert.NotNull(resolvedDependencies);
773
- Assert.Single(resolvedDependencies.Value);
774
- Assert.Equal("Azure.Core", resolvedDependencies.Value[0].Name);
775
- Assert.Equal("1.22.0", resolvedDependencies.Value[0].Version);
792
+ var actualResolvedDependencies = resolvedDependencies.Value.Select(d => $"{d.Name}/{d.Version}").ToArray();
793
+ var expectedResolvedDependencies = new[]
794
+ {
795
+ "Azure.Core/1.22.0",
796
+ };
797
+ AssertEx.Equal(expectedResolvedDependencies, actualResolvedDependencies);
776
798
  }
777
799
 
778
800
  // Adding a reference
@@ -787,14 +809,21 @@ public class MSBuildHelperTests : TestBase
787
809
  var projectPath = Path.Join(tempDirectory.DirectoryPath, "project.csproj");
788
810
  await File.WriteAllTextAsync(projectPath, """
789
811
  <Project Sdk="Microsoft.NET.Sdk">
790
- <PropertyGroup>
812
+ <PropertyGroup>
791
813
  <TargetFramework>net8.0</TargetFramework>
792
- </PropertyGroup>
793
- <ItemGroup>
814
+ </PropertyGroup>
815
+ <ItemGroup>
794
816
  <PackageReference Include="Newtonsoft.Json.Bson" Version="1.0.2" />
795
- </ItemGroup>
817
+ </ItemGroup>
796
818
  </Project>
797
819
  """);
820
+ await UpdateWorkerTestBase.MockNuGetPackagesInDirectory([
821
+ // initial packages
822
+ MockNuGetPackage.CreateSimplePackage("Newtonsoft.Json.Bson", "1.0.2", "net8.0", [(null, [("Newtonsoft.Json", "12.0.1")])]),
823
+ MockNuGetPackage.CreateSimplePackage("Newtonsoft.Json", "12.0.1", "net8.0"),
824
+ // available packages
825
+ MockNuGetPackage.CreateSimplePackage("Newtonsoft.Json", "13.0.1", "net8.0")
826
+ ], tempDirectory.DirectoryPath);
798
827
 
799
828
  var dependencies = new[]
800
829
  {
@@ -815,11 +844,13 @@ public class MSBuildHelperTests : TestBase
815
844
  new TestLogger()
816
845
  );
817
846
  Assert.NotNull(resolvedDependencies);
818
- Assert.Equal(2, resolvedDependencies.Value.Length);
819
- Assert.Equal("Newtonsoft.Json.Bson", resolvedDependencies.Value[0].Name);
820
- Assert.Equal("1.0.2", resolvedDependencies.Value[0].Version);
821
- Assert.Equal("Newtonsoft.Json", resolvedDependencies.Value[1].Name);
822
- Assert.Equal("13.0.1", resolvedDependencies.Value[1].Version);
847
+ var actualResolvedDependencies = resolvedDependencies.Value.Select(d => $"{d.Name}/{d.Version}").ToArray();
848
+ var expectedResolvedDependencies = new[]
849
+ {
850
+ "Newtonsoft.Json.Bson/1.0.2",
851
+ "Newtonsoft.Json/13.0.1",
852
+ };
853
+ AssertEx.Equal(expectedResolvedDependencies, actualResolvedDependencies);
823
854
  }
824
855
 
825
856
  // Updating unreferenced dependency
@@ -835,16 +866,28 @@ public class MSBuildHelperTests : TestBase
835
866
  var projectPath = Path.Join(tempDirectory.DirectoryPath, "project.csproj");
836
867
  await File.WriteAllTextAsync(projectPath, """
837
868
  <Project Sdk="Microsoft.NET.Sdk">
838
- <PropertyGroup>
869
+ <PropertyGroup>
839
870
  <TargetFramework>net8.0</TargetFramework>
840
- </PropertyGroup>
841
- <ItemGroup>
871
+ </PropertyGroup>
872
+ <ItemGroup>
842
873
  <PackageReference Include="Microsoft.CodeAnalysis.Compilers" Version="4.9.2" />
843
874
  <PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.9.2" />
844
875
  <PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="4.9.2" />
845
- </ItemGroup>
876
+ </ItemGroup>
846
877
  </Project>
847
878
  """);
879
+ await UpdateWorkerTestBase.MockNuGetPackagesInDirectory([
880
+ // initial packages
881
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.Compilers", "4.9.2", "net8.0", [(null, [("Microsoft.CodeAnalysis.Common", "[4.9.2]"), ("Microsoft.CodeAnalysis.CSharp", "[4.9.2]"), ("Microsoft.CodeAnalysis.VisualBasic", "[4.9.2]")])]),
882
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.Common", "4.9.2", "net8.0"),
883
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.CSharp", "4.9.2", "net8.0"),
884
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.VisualBasic", "4.9.2", "net8.0"),
885
+ // available packages
886
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.Compilers", "4.10.0", "net8.0", [(null, [("Microsoft.CodeAnalysis.Common", "[4.10.0]"), ("Microsoft.CodeAnalysis.CSharp", "[4.10.0]"), ("Microsoft.CodeAnalysis.VisualBasic", "[4.10.0]")])]),
887
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.Common", "4.10.0", "net8.0"),
888
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.CSharp", "4.10.0", "net8.0"),
889
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.VisualBasic", "4.10.0", "net8.0")
890
+ ], tempDirectory.DirectoryPath);
848
891
 
849
892
  var dependencies = new[]
850
893
  {
@@ -867,13 +910,14 @@ public class MSBuildHelperTests : TestBase
867
910
  new TestLogger()
868
911
  );
869
912
  Assert.NotNull(resolvedDependencies);
870
- Assert.Equal(3, resolvedDependencies.Value.Length);
871
- Assert.Equal("Microsoft.CodeAnalysis.Compilers", resolvedDependencies.Value[0].Name);
872
- Assert.Equal("4.10.0", resolvedDependencies.Value[0].Version);
873
- Assert.Equal("Microsoft.CodeAnalysis.CSharp", resolvedDependencies.Value[1].Name);
874
- Assert.Equal("4.10.0", resolvedDependencies.Value[1].Version);
875
- Assert.Equal("Microsoft.CodeAnalysis.VisualBasic", resolvedDependencies.Value[2].Name);
876
- Assert.Equal("4.10.0", resolvedDependencies.Value[2].Version);
913
+ var actualResolvedDependencies = resolvedDependencies.Value.Select(d => $"{d.Name}/{d.Version}").ToArray();
914
+ var expectedResolvedDependencies = new[]
915
+ {
916
+ "Microsoft.CodeAnalysis.Compilers/4.10.0",
917
+ "Microsoft.CodeAnalysis.CSharp/4.10.0",
918
+ "Microsoft.CodeAnalysis.VisualBasic/4.10.0",
919
+ };
920
+ AssertEx.Equal(expectedResolvedDependencies, actualResolvedDependencies);
877
921
  }
878
922
 
879
923
  // Updating referenced dependency
@@ -887,17 +931,29 @@ public class MSBuildHelperTests : TestBase
887
931
  var projectPath = Path.Join(tempDirectory.DirectoryPath, "project.csproj");
888
932
  await File.WriteAllTextAsync(projectPath, """
889
933
  <Project Sdk="Microsoft.NET.Sdk">
890
- <PropertyGroup>
934
+ <PropertyGroup>
891
935
  <TargetFramework>net8.0</TargetFramework>
892
- </PropertyGroup>
893
- <ItemGroup>
936
+ </PropertyGroup>
937
+ <ItemGroup>
894
938
  <PackageReference Include="Microsoft.CodeAnalysis.Compilers" Version="4.9.2" />
895
939
  <PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.9.2" />
896
940
  <PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.9.2" />
897
941
  <PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="4.9.2" />
898
- </ItemGroup>
942
+ </ItemGroup>
899
943
  </Project>
900
944
  """);
945
+ await UpdateWorkerTestBase.MockNuGetPackagesInDirectory([
946
+ // initial packages
947
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.Compilers", "4.9.2", "net8.0", [(null, [("Microsoft.CodeAnalysis.Common", "[4.9.2]"), ("Microsoft.CodeAnalysis.CSharp", "[4.9.2]"), ("Microsoft.CodeAnalysis.VisualBasic", "[4.9.2]")])]),
948
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.Common", "4.9.2", "net8.0"),
949
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.CSharp", "4.9.2", "net8.0"),
950
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.VisualBasic", "4.9.2", "net8.0"),
951
+ // available packages
952
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.Compilers", "4.10.0", "net8.0", [(null, [("Microsoft.CodeAnalysis.Common", "[4.10.0]"), ("Microsoft.CodeAnalysis.CSharp", "[4.10.0]"), ("Microsoft.CodeAnalysis.VisualBasic", "[4.10.0]")])]),
953
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.Common", "4.10.0", "net8.0"),
954
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.CSharp", "4.10.0", "net8.0"),
955
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.VisualBasic", "4.10.0", "net8.0")
956
+ ], tempDirectory.DirectoryPath);
901
957
 
902
958
  var dependencies = new[]
903
959
  {
@@ -921,15 +977,15 @@ public class MSBuildHelperTests : TestBase
921
977
  new TestLogger()
922
978
  );
923
979
  Assert.NotNull(resolvedDependencies);
924
- Assert.Equal(4, resolvedDependencies.Value.Length);
925
- Assert.Equal("Microsoft.CodeAnalysis.Compilers", resolvedDependencies.Value[0].Name);
926
- Assert.Equal("4.10.0", resolvedDependencies.Value[0].Version);
927
- Assert.Equal("Microsoft.CodeAnalysis.Common", resolvedDependencies.Value[1].Name);
928
- Assert.Equal("4.10.0", resolvedDependencies.Value[1].Version);
929
- Assert.Equal("Microsoft.CodeAnalysis.CSharp", resolvedDependencies.Value[2].Name);
930
- Assert.Equal("4.10.0", resolvedDependencies.Value[2].Version);
931
- Assert.Equal("Microsoft.CodeAnalysis.VisualBasic", resolvedDependencies.Value[3].Name);
932
- Assert.Equal("4.10.0", resolvedDependencies.Value[3].Version);
980
+ var actualResolvedDependencies = resolvedDependencies.Value.Select(d => $"{d.Name}/{d.Version}").ToArray();
981
+ var expectedResolvedDependencies = new[]
982
+ {
983
+ "Microsoft.CodeAnalysis.Compilers/4.10.0",
984
+ "Microsoft.CodeAnalysis.Common/4.10.0",
985
+ "Microsoft.CodeAnalysis.CSharp/4.10.0",
986
+ "Microsoft.CodeAnalysis.VisualBasic/4.10.0",
987
+ };
988
+ AssertEx.Equal(expectedResolvedDependencies, actualResolvedDependencies);
933
989
  }
934
990
 
935
991
  // A combination of the third and fourth test, to measure efficiency of updating separate families
@@ -944,17 +1000,31 @@ public class MSBuildHelperTests : TestBase
944
1000
  var projectPath = Path.Join(tempDirectory.DirectoryPath, "project.csproj");
945
1001
  await File.WriteAllTextAsync(projectPath, """
946
1002
  <Project Sdk="Microsoft.NET.Sdk">
947
- <PropertyGroup>
1003
+ <PropertyGroup>
948
1004
  <TargetFramework>net8.0</TargetFramework>
949
- </PropertyGroup>
950
- <ItemGroup>
1005
+ </PropertyGroup>
1006
+ <ItemGroup>
951
1007
  <PackageReference Include="Microsoft.CodeAnalysis.Compilers" Version="4.9.2" />
952
1008
  <PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.9.2" />
953
1009
  <PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="4.9.2" />
954
1010
  <PackageReference Include="Newtonsoft.Json.Bson" Version="1.0.2" />
955
- </ItemGroup>
1011
+ </ItemGroup>
956
1012
  </Project>
957
1013
  """);
1014
+ await UpdateWorkerTestBase.MockNuGetPackagesInDirectory([
1015
+ // initial packages
1016
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.Compilers", "4.9.2", "net8.0", [(null, [("Microsoft.CodeAnalysis.Common", "[4.9.2]"), ("Microsoft.CodeAnalysis.CSharp", "[4.9.2]"), ("Microsoft.CodeAnalysis.VisualBasic", "[4.9.2]")])]),
1017
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.Common", "4.9.2", "net8.0"),
1018
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.CSharp", "4.9.2", "net8.0"),
1019
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.VisualBasic", "4.9.2", "net8.0"),
1020
+ MockNuGetPackage.CreateSimplePackage("Newtonsoft.Json.Bson", "1.0.2", "net8.0", [(null, [("Newtonsoft.Json", "13.0.1")])]),
1021
+ MockNuGetPackage.CreateSimplePackage("Newtonsoft.Json", "13.0.1", "net8.0"),
1022
+ // available packages
1023
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.Compilers", "4.10.0", "net8.0", [(null, [("Microsoft.CodeAnalysis.Common", "[4.10.0]"), ("Microsoft.CodeAnalysis.CSharp", "[4.10.0]"), ("Microsoft.CodeAnalysis.VisualBasic", "[4.10.0]")])]),
1024
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.Common", "4.10.0", "net8.0"),
1025
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.CSharp", "4.10.0", "net8.0"),
1026
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.VisualBasic", "4.10.0", "net8.0")
1027
+ ], tempDirectory.DirectoryPath);
958
1028
 
959
1029
  var dependencies = new[]
960
1030
  {
@@ -979,17 +1049,16 @@ public class MSBuildHelperTests : TestBase
979
1049
  new TestLogger()
980
1050
  );
981
1051
  Assert.NotNull(resolvedDependencies);
982
- Assert.Equal(5, resolvedDependencies.Value.Length);
983
- Assert.Equal("Microsoft.CodeAnalysis.Compilers", resolvedDependencies.Value[0].Name);
984
- Assert.Equal("4.10.0", resolvedDependencies.Value[0].Version);
985
- Assert.Equal("Microsoft.CodeAnalysis.CSharp", resolvedDependencies.Value[1].Name);
986
- Assert.Equal("4.10.0", resolvedDependencies.Value[1].Version);
987
- Assert.Equal("Microsoft.CodeAnalysis.VisualBasic", resolvedDependencies.Value[2].Name);
988
- Assert.Equal("4.10.0", resolvedDependencies.Value[2].Version);
989
- Assert.Equal("Newtonsoft.Json.Bson", resolvedDependencies.Value[3].Name);
990
- Assert.Equal("1.0.2", resolvedDependencies.Value[3].Version);
991
- Assert.Equal("Newtonsoft.Json", resolvedDependencies.Value[4].Name);
992
- Assert.Equal("13.0.1", resolvedDependencies.Value[4].Version);
1052
+ var actualResolvedDependencies = resolvedDependencies.Value.Select(d => $"{d.Name}/{d.Version}").ToArray();
1053
+ var expectedResolvedDependencies = new[]
1054
+ {
1055
+ "Microsoft.CodeAnalysis.Compilers/4.10.0",
1056
+ "Microsoft.CodeAnalysis.CSharp/4.10.0",
1057
+ "Microsoft.CodeAnalysis.VisualBasic/4.10.0",
1058
+ "Newtonsoft.Json.Bson/1.0.2",
1059
+ "Newtonsoft.Json/13.0.1",
1060
+ };
1061
+ AssertEx.Equal(expectedResolvedDependencies, actualResolvedDependencies);
993
1062
  }
994
1063
 
995
1064
  // Two top level packages (Buildalyzer), (Microsoft.CodeAnalysis.CSharp.Scripting) that share a dependency (Microsoft.CodeAnalysis.Csharp)
@@ -1081,23 +1150,39 @@ public class MSBuildHelperTests : TestBase
1081
1150
  var projectPath = Path.Join(tempDirectory.DirectoryPath, "project.csproj");
1082
1151
  await File.WriteAllTextAsync(projectPath, """
1083
1152
  <Project Sdk="Microsoft.NET.Sdk">
1084
- <PropertyGroup>
1153
+ <PropertyGroup>
1085
1154
  <TargetFramework>net8.0</TargetFramework>
1086
- </PropertyGroup>
1087
- <ItemGroup>
1155
+ </PropertyGroup>
1156
+ <ItemGroup>
1088
1157
  <PackageReference Include="System.Collections.Immutable" Version="7.0.0" />
1089
1158
  <PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.8.0" />
1090
1159
  <PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="1.0.0" />
1091
1160
  <PackageReference Include="Azure.Core" Version="1.21.0" />
1092
- </ItemGroup>
1161
+ </ItemGroup>
1093
1162
  </Project>
1094
1163
  """);
1164
+ await UpdateWorkerTestBase.MockNuGetPackagesInDirectory([
1165
+ // initial packages
1166
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.CSharp.Scripting", "4.8.0", "net8.0", [(null, [("Microsoft.CodeAnalysis.CSharp", "[4.8.0]"), ("Microsoft.CodeAnalysis.Common", "[4.8.0]")])]),
1167
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.CSharp", "4.8.0", "net8.0", [(null, [("Microsoft.CodeAnalysis.Common", "[4.8.0]")])]),
1168
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.Common", "4.8.0", "net8.0", [(null, [("System.Collections.Immutable", "7.0.0")])]),
1169
+ MockNuGetPackage.CreateSimplePackage("System.Collections.Immutable", "7.0.0", "net8.0"),
1170
+ MockNuGetPackage.CreateSimplePackage("Azure.Core", "1.21.0", "net8.0", [(null, [("Microsoft.Bcl.AsyncInterfaces", "1.0.0")])]),
1171
+ MockNuGetPackage.CreateSimplePackage("Microsoft.Bcl.AsyncInterfaces", "1.0.0", "net8.0"),
1172
+ // available packages
1173
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.CSharp.Scripting", "4.10.0", "net8.0", [(null, [("Microsoft.CodeAnalysis.CSharp", "[4.10.0]"), ("Microsoft.CodeAnalysis.Common", "[4.10.0]")])]),
1174
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.CSharp", "4.10.0", "net8.0", [(null, [("Microsoft.CodeAnalysis.Common", "[4.10.0]")])]),
1175
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.Common", "4.10.0", "net8.0", [(null, [("System.Collections.Immutable", "8.0.0")])]),
1176
+ MockNuGetPackage.CreateSimplePackage("System.Collections.Immutable", "8.0.0", "net8.0"),
1177
+ MockNuGetPackage.CreateSimplePackage("Azure.Core", "1.22.0", "net8.0", [(null, [("Microsoft.Bcl.AsyncInterfaces", "1.1.1")])]),
1178
+ MockNuGetPackage.CreateSimplePackage("Microsoft.Bcl.AsyncInterfaces", "1.1.1", "net8.0"),
1179
+ ], tempDirectory.DirectoryPath);
1095
1180
 
1096
1181
  var dependencies = new[]
1097
1182
  {
1098
1183
  new Dependency("System.Collections.Immutable", "7.0.0", DependencyType.PackageReference),
1099
1184
  new Dependency("Microsoft.CodeAnalysis.CSharp.Scripting", "4.8.0", DependencyType.PackageReference),
1100
- new Dependency("Microsoft.Bcl.AsyncInterfaces", "1.0.0", DependencyType.Unknown),
1185
+ new Dependency("Microsoft.Bcl.AsyncInterfaces", "1.0.0", DependencyType.PackageReference),
1101
1186
  new Dependency("Azure.Core", "1.21.0", DependencyType.PackageReference),
1102
1187
  }.ToImmutableArray();
1103
1188
  var update = new[]
@@ -1116,15 +1201,15 @@ public class MSBuildHelperTests : TestBase
1116
1201
  new TestLogger()
1117
1202
  );
1118
1203
  Assert.NotNull(resolvedDependencies);
1119
- Assert.Equal(4, resolvedDependencies.Value.Length);
1120
- Assert.Equal("System.Collections.Immutable", resolvedDependencies.Value[0].Name);
1121
- Assert.Equal("8.0.0", resolvedDependencies.Value[0].Version);
1122
- Assert.Equal("Microsoft.CodeAnalysis.CSharp.Scripting", resolvedDependencies.Value[1].Name);
1123
- Assert.Equal("4.10.0", resolvedDependencies.Value[1].Version);
1124
- Assert.Equal("Microsoft.Bcl.AsyncInterfaces", resolvedDependencies.Value[2].Name);
1125
- Assert.Equal("1.1.1", resolvedDependencies.Value[2].Version);
1126
- Assert.Equal("Azure.Core", resolvedDependencies.Value[3].Name);
1127
- Assert.Equal("1.22.0", resolvedDependencies.Value[3].Version);
1204
+ var actualResolvedDependencies = resolvedDependencies.Value.Select(d => $"{d.Name}/{d.Version}").ToArray();
1205
+ var expectedResolvedDependencies = new[]
1206
+ {
1207
+ "System.Collections.Immutable/8.0.0",
1208
+ "Microsoft.CodeAnalysis.CSharp.Scripting/4.10.0",
1209
+ "Microsoft.Bcl.AsyncInterfaces/1.1.1",
1210
+ "Azure.Core/1.22.0",
1211
+ };
1212
+ AssertEx.Equal(expectedResolvedDependencies, actualResolvedDependencies);
1128
1213
  }
1129
1214
 
1130
1215
  // Similar to the last test, except Microsoft.CodeAnalysis.Common is in the existing list
@@ -1137,18 +1222,34 @@ public class MSBuildHelperTests : TestBase
1137
1222
  var projectPath = Path.Join(tempDirectory.DirectoryPath, "project.csproj");
1138
1223
  await File.WriteAllTextAsync(projectPath, """
1139
1224
  <Project Sdk="Microsoft.NET.Sdk">
1140
- <PropertyGroup>
1225
+ <PropertyGroup>
1141
1226
  <TargetFramework>net8.0</TargetFramework>
1142
- </PropertyGroup>
1143
- <ItemGroup>
1227
+ </PropertyGroup>
1228
+ <ItemGroup>
1144
1229
  <PackageReference Include="System.Collections.Immutable" Version="7.0.0" />
1145
1230
  <PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.8.0" />
1146
1231
  <PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.8.0" />
1147
1232
  <PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="1.0.0" />
1148
1233
  <PackageReference Include="Azure.Core" Version="1.21.0" />
1149
- </ItemGroup>
1234
+ </ItemGroup>
1150
1235
  </Project>
1151
1236
  """);
1237
+ await UpdateWorkerTestBase.MockNuGetPackagesInDirectory([
1238
+ // initial packages
1239
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.CSharp.Scripting", "4.8.0", "net8.0", [(null, [("Microsoft.CodeAnalysis.CSharp", "[4.8.0]"), ("Microsoft.CodeAnalysis.Common", "[4.8.0]")])]),
1240
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.CSharp", "4.8.0", "net8.0", [(null, [("Microsoft.CodeAnalysis.Common", "[4.8.0]")])]),
1241
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.Common", "4.8.0", "net8.0", [(null, [("System.Collections.Immutable", "7.0.0")])]),
1242
+ MockNuGetPackage.CreateSimplePackage("System.Collections.Immutable", "7.0.0", "net8.0"),
1243
+ MockNuGetPackage.CreateSimplePackage("Azure.Core", "1.21.0", "net8.0", [(null, [("Microsoft.Bcl.AsyncInterfaces", "1.0.0")])]),
1244
+ MockNuGetPackage.CreateSimplePackage("Microsoft.Bcl.AsyncInterfaces", "1.0.0", "net8.0"),
1245
+ // available packages
1246
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.CSharp.Scripting", "4.10.0", "net8.0", [(null, [("Microsoft.CodeAnalysis.CSharp", "[4.10.0]"), ("Microsoft.CodeAnalysis.Common", "[4.10.0]")])]),
1247
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.CSharp", "4.10.0", "net8.0", [(null, [("Microsoft.CodeAnalysis.Common", "[4.10.0]")])]),
1248
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.Common", "4.10.0", "net8.0", [(null, [("System.Collections.Immutable", "8.0.0")])]),
1249
+ MockNuGetPackage.CreateSimplePackage("System.Collections.Immutable", "8.0.0", "net8.0"),
1250
+ MockNuGetPackage.CreateSimplePackage("Azure.Core", "1.22.0", "net8.0", [(null, [("Microsoft.Bcl.AsyncInterfaces", "1.1.1")])]),
1251
+ MockNuGetPackage.CreateSimplePackage("Microsoft.Bcl.AsyncInterfaces", "1.1.1", "net8.0"),
1252
+ ], tempDirectory.DirectoryPath);
1152
1253
 
1153
1254
  var dependencies = new[]
1154
1255
  {
@@ -1175,17 +1276,16 @@ public class MSBuildHelperTests : TestBase
1175
1276
  new TestLogger()
1176
1277
  );
1177
1278
  Assert.NotNull(resolvedDependencies);
1178
- Assert.Equal(5, resolvedDependencies.Value.Length);
1179
- Assert.Equal("System.Collections.Immutable", resolvedDependencies.Value[0].Name);
1180
- Assert.Equal("8.0.0", resolvedDependencies.Value[0].Version);
1181
- Assert.Equal("Microsoft.CodeAnalysis.CSharp.Scripting", resolvedDependencies.Value[1].Name);
1182
- Assert.Equal("4.10.0", resolvedDependencies.Value[1].Version);
1183
- Assert.Equal("Microsoft.CodeAnalysis.Common", resolvedDependencies.Value[2].Name);
1184
- Assert.Equal("4.10.0", resolvedDependencies.Value[2].Version);
1185
- Assert.Equal("Microsoft.Bcl.AsyncInterfaces", resolvedDependencies.Value[3].Name);
1186
- Assert.Equal("1.1.1", resolvedDependencies.Value[3].Version);
1187
- Assert.Equal("Azure.Core", resolvedDependencies.Value[4].Name);
1188
- Assert.Equal("1.22.0", resolvedDependencies.Value[4].Version);
1279
+ var actualResolvedDependencies = resolvedDependencies.Value.Select(d => $"{d.Name}/{d.Version}").ToArray();
1280
+ var expectedResolvedDependencies = new[]
1281
+ {
1282
+ "System.Collections.Immutable/8.0.0",
1283
+ "Microsoft.CodeAnalysis.CSharp.Scripting/4.10.0",
1284
+ "Microsoft.CodeAnalysis.Common/4.10.0",
1285
+ "Microsoft.Bcl.AsyncInterfaces/1.1.1",
1286
+ "Azure.Core/1.22.0"
1287
+ };
1288
+ AssertEx.Equal(expectedResolvedDependencies, actualResolvedDependencies);
1189
1289
  }
1190
1290
 
1191
1291
  // Out of scope test: AutoMapper.Extensions.Microsoft.DependencyInjection's versions are not yet compatible
@@ -1200,16 +1300,23 @@ public class MSBuildHelperTests : TestBase
1200
1300
  var projectPath = Path.Join(tempDirectory.DirectoryPath, "project.csproj");
1201
1301
  await File.WriteAllTextAsync(projectPath, """
1202
1302
  <Project Sdk="Microsoft.NET.Sdk">
1203
- <PropertyGroup>
1303
+ <PropertyGroup>
1204
1304
  <TargetFramework>net8.0</TargetFramework>
1205
- </PropertyGroup>
1206
- <ItemGroup>
1305
+ </PropertyGroup>
1306
+ <ItemGroup>
1207
1307
  <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
1208
1308
  <PackageReference Include="AutoMapper" Version="12.0.1" />
1209
1309
  <PackageReference Include="AutoMapper.Collection" Version="9.0.0" />
1210
- </ItemGroup>
1310
+ </ItemGroup>
1211
1311
  </Project>
1212
1312
  """);
1313
+ await UpdateWorkerTestBase.MockNuGetPackagesInDirectory([
1314
+ MockNuGetPackage.CreateSimplePackage("AutoMapper.Extensions.Microsoft.DependencyInjection", "12.0.1", "net8.0", [(null, [("AutoMapper", "[12.0.1]")])]),
1315
+ MockNuGetPackage.CreateSimplePackage("AutoMapper", "12.0.1", "net8.0"),
1316
+ MockNuGetPackage.CreateSimplePackage("AutoMapper", "13.0.1", "net8.0"),
1317
+ MockNuGetPackage.CreateSimplePackage("AutoMapper.Collection", "9.0.0", "net8.0", [(null, [("AutoMapper", "[12.0.0, 13.0.0)")])]),
1318
+ MockNuGetPackage.CreateSimplePackage("AutoMapper.Collection", "10.0.0", "net8.0", [(null, [("AutoMapper", "[13.0.0, 14.0.0)")])])
1319
+ ], tempDirectory.DirectoryPath);
1213
1320
 
1214
1321
  var dependencies = new[]
1215
1322
  {
@@ -1232,13 +1339,14 @@ public class MSBuildHelperTests : TestBase
1232
1339
  new TestLogger()
1233
1340
  );
1234
1341
  Assert.NotNull(resolvedDependencies);
1235
- Assert.Equal(3, resolvedDependencies.Value.Length);
1236
- Assert.Equal("AutoMapper.Extensions.Microsoft.DependencyInjection", resolvedDependencies.Value[0].Name);
1237
- Assert.Equal("12.0.1", resolvedDependencies.Value[0].Version);
1238
- Assert.Equal("AutoMapper", resolvedDependencies.Value[1].Name);
1239
- Assert.Equal("12.0.1", resolvedDependencies.Value[1].Version);
1240
- Assert.Equal("AutoMapper.Collection", resolvedDependencies.Value[2].Name);
1241
- Assert.Equal("9.0.0", resolvedDependencies.Value[2].Version);
1342
+ var actualResolvedDependencies = resolvedDependencies.Value.Select(d => $"{d.Name}/{d.Version}").ToArray();
1343
+ var expectedResolvedDependencies = new[]
1344
+ {
1345
+ "AutoMapper.Extensions.Microsoft.DependencyInjection/12.0.1",
1346
+ "AutoMapper/12.0.1",
1347
+ "AutoMapper.Collection/9.0.0",
1348
+ };
1349
+ AssertEx.Equal(expectedResolvedDependencies, actualResolvedDependencies);
1242
1350
  }
1243
1351
 
1244
1352
  // Two dependencies (Microsoft.Extensions.Caching.Memory), (Microsoft.EntityFrameworkCore.Analyzers) used by the same parent (Microsoft.EntityFrameworkCore), updating one of the dependencies
@@ -1251,15 +1359,25 @@ public class MSBuildHelperTests : TestBase
1251
1359
  var projectPath = Path.Join(tempDirectory.DirectoryPath, "project.csproj");
1252
1360
  await File.WriteAllTextAsync(projectPath, """
1253
1361
  <Project Sdk="Microsoft.NET.Sdk">
1254
- <PropertyGroup>
1362
+ <PropertyGroup>
1255
1363
  <TargetFramework>net8.0</TargetFramework>
1256
- </PropertyGroup>
1257
- <ItemGroup>
1364
+ </PropertyGroup>
1365
+ <ItemGroup>
1258
1366
  <PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.11" />
1259
1367
  <PackageReference Include="Microsoft.EntityFrameworkCore.Analyzers" Version="7.0.11" />
1260
- </ItemGroup>
1368
+ </ItemGroup>
1261
1369
  </Project>
1262
1370
  """);
1371
+ await UpdateWorkerTestBase.MockNuGetPackagesInDirectory([
1372
+ // initial packages
1373
+ MockNuGetPackage.CreateSimplePackage("Microsoft.EntityFrameworkCore", "7.0.11", "net8.0", [(null, [("Microsoft.EntityFrameworkCore.Analyzers", "7.0.11"), ("Microsoft.Extensions.Caching.Memory", "7.0.0")])]),
1374
+ MockNuGetPackage.CreateSimplePackage("Microsoft.EntityFrameworkCore.Analyzers", "7.0.11", "net8.0"),
1375
+ MockNuGetPackage.CreateSimplePackage("Microsoft.Extensions.Caching.Memory", "7.0.0", "net8.0"),
1376
+ // available packages
1377
+ MockNuGetPackage.CreateSimplePackage("Microsoft.EntityFrameworkCore", "8.0.0", "net8.0", [(null, [("Microsoft.EntityFrameworkCore.Analyzers", "8.0.0"), ("Microsoft.Extensions.Caching.Memory", "8.0.0")])]),
1378
+ MockNuGetPackage.CreateSimplePackage("Microsoft.EntityFrameworkCore.Analyzers", "8.0.0", "net8.0"),
1379
+ MockNuGetPackage.CreateSimplePackage("Microsoft.Extensions.Caching.Memory", "8.0.0", "net8.0"),
1380
+ ], tempDirectory.DirectoryPath);
1263
1381
 
1264
1382
  var dependencies = new[]
1265
1383
  {
@@ -1281,11 +1399,13 @@ public class MSBuildHelperTests : TestBase
1281
1399
  new TestLogger()
1282
1400
  );
1283
1401
  Assert.NotNull(resolvedDependencies);
1284
- Assert.Equal(2, resolvedDependencies.Value.Length);
1285
- Assert.Equal("Microsoft.EntityFrameworkCore", resolvedDependencies.Value[0].Name);
1286
- Assert.Equal("8.0.0", resolvedDependencies.Value[0].Version);
1287
- Assert.Equal("Microsoft.EntityFrameworkCore.Analyzers", resolvedDependencies.Value[1].Name);
1288
- Assert.Equal("8.0.0", resolvedDependencies.Value[1].Version);
1402
+ var actualResolvedDependencies = resolvedDependencies.Value.Select(d => $"{d.Name}/{d.Version}").ToArray();
1403
+ var expectedResolvedDependencies = new[]
1404
+ {
1405
+ "Microsoft.EntityFrameworkCore/8.0.0",
1406
+ "Microsoft.EntityFrameworkCore.Analyzers/8.0.0",
1407
+ };
1408
+ AssertEx.Equal(expectedResolvedDependencies, actualResolvedDependencies);
1289
1409
  }
1290
1410
 
1291
1411
  // Updating referenced package
@@ -1299,17 +1419,26 @@ public class MSBuildHelperTests : TestBase
1299
1419
  var projectPath = Path.Join(tempDirectory.DirectoryPath, "project.csproj");
1300
1420
  await File.WriteAllTextAsync(projectPath, """
1301
1421
  <Project Sdk="Microsoft.NET.Sdk">
1302
- <PropertyGroup>
1422
+ <PropertyGroup>
1303
1423
  <TargetFramework>net8.0</TargetFramework>
1304
- </PropertyGroup>
1305
- <ItemGroup>
1424
+ </PropertyGroup>
1425
+ <ItemGroup>
1306
1426
  <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.0" />
1307
1427
  <PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.0" />
1308
- <PackageReference Include= "Microsoft.EntityFrameworkCore" Version="7.0.0" />
1428
+ <PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0" />
1309
1429
  <PackageReference Include="Microsoft.EntityFrameworkCore.Analyzers" Version="7.0.0" />
1310
- </ItemGroup>
1430
+ </ItemGroup>
1311
1431
  </Project>
1312
1432
  """);
1433
+ await UpdateWorkerTestBase.MockNuGetPackagesInDirectory([
1434
+ // initial packages
1435
+ MockNuGetPackage.CreateSimplePackage("Microsoft.EntityFrameworkCore.Design", "7.0.0", "net8.0", [(null, [("Microsoft.EntityFrameworkCore.Relational", "[7.0.0]")])]),
1436
+ MockNuGetPackage.CreateSimplePackage("Microsoft.EntityFrameworkCore.Relational", "7.0.0", "net8.0", [(null, [("Microsoft.EntityFrameworkCore", "[7.0.0]")])]),
1437
+ MockNuGetPackage.CreateSimplePackage("Microsoft.EntityFrameworkCore", "7.0.0", "net8.0", [(null, [("Microsoft.EntityFrameworkCore.Analyzers", "[7.0.0]")])]),
1438
+ MockNuGetPackage.CreateSimplePackage("Microsoft.EntityFrameworkCore.Analyzers", "7.0.0", "net8.0"),
1439
+ // available packages
1440
+ MockNuGetPackage.CreateSimplePackage("Microsoft.EntityFrameworkCore.Analyzers", "8.0.0", "net8.0")
1441
+ ], tempDirectory.DirectoryPath);
1313
1442
 
1314
1443
  var dependencies = new[]
1315
1444
  {
@@ -1333,15 +1462,15 @@ public class MSBuildHelperTests : TestBase
1333
1462
  new TestLogger()
1334
1463
  );
1335
1464
  Assert.NotNull(resolvedDependencies);
1336
- Assert.Equal(4, resolvedDependencies.Value.Length);
1337
- Assert.Equal("Microsoft.EntityFrameworkCore.Design", resolvedDependencies.Value[0].Name);
1338
- Assert.Equal("7.0.0", resolvedDependencies.Value[0].Version);
1339
- Assert.Equal("Microsoft.EntityFrameworkCore.Relational", resolvedDependencies.Value[1].Name);
1340
- Assert.Equal("7.0.0", resolvedDependencies.Value[1].Version);
1341
- Assert.Equal("Microsoft.EntityFrameworkCore", resolvedDependencies.Value[2].Name);
1342
- Assert.Equal("7.0.0", resolvedDependencies.Value[2].Version);
1343
- Assert.Equal("Microsoft.EntityFrameworkCore.Analyzers", resolvedDependencies.Value[3].Name);
1344
- Assert.Equal("8.0.0", resolvedDependencies.Value[3].Version);
1465
+ var actualResolvedDependencies = resolvedDependencies.Value.Select(d => $"{d.Name}/{d.Version}").ToArray();
1466
+ var expectedResolvedDependencies = new[]
1467
+ {
1468
+ "Microsoft.EntityFrameworkCore.Design/7.0.0",
1469
+ "Microsoft.EntityFrameworkCore.Relational/7.0.0",
1470
+ "Microsoft.EntityFrameworkCore/7.0.0",
1471
+ "Microsoft.EntityFrameworkCore.Analyzers/8.0.0",
1472
+ };
1473
+ AssertEx.Equal(expectedResolvedDependencies, actualResolvedDependencies);
1345
1474
  }
1346
1475
 
1347
1476
  // Updating unreferenced package
@@ -1355,16 +1484,28 @@ public class MSBuildHelperTests : TestBase
1355
1484
  var projectPath = Path.Join(tempDirectory.DirectoryPath, "project.csproj");
1356
1485
  await File.WriteAllTextAsync(projectPath, """
1357
1486
  <Project Sdk="Microsoft.NET.Sdk">
1358
- <PropertyGroup>
1487
+ <PropertyGroup>
1359
1488
  <TargetFramework>net8.0</TargetFramework>
1360
- </PropertyGroup>
1361
- <ItemGroup>
1489
+ </PropertyGroup>
1490
+ <ItemGroup>
1362
1491
  <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.0" />
1363
1492
  <PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.0" />
1364
1493
  <PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0" />
1365
- </ItemGroup>
1494
+ </ItemGroup>
1366
1495
  </Project>
1367
1496
  """);
1497
+ await UpdateWorkerTestBase.MockNuGetPackagesInDirectory([
1498
+ // initial packages
1499
+ MockNuGetPackage.CreateSimplePackage("Microsoft.EntityFrameworkCore.Design", "7.0.0", "net8.0", [(null, [("Microsoft.EntityFrameworkCore.Relational", "[7.0.0]")])]),
1500
+ MockNuGetPackage.CreateSimplePackage("Microsoft.EntityFrameworkCore.Relational", "7.0.0", "net8.0", [(null, [("Microsoft.EntityFrameworkCore", "[7.0.0]")])]),
1501
+ MockNuGetPackage.CreateSimplePackage("Microsoft.EntityFrameworkCore", "7.0.0", "net8.0", [(null, [("Microsoft.EntityFrameworkCore.Analyzers", "[7.0.0]")])]),
1502
+ MockNuGetPackage.CreateSimplePackage("Microsoft.EntityFrameworkCore.Analyzers", "7.0.0", "net8.0"),
1503
+ // available packages
1504
+ MockNuGetPackage.CreateSimplePackage("Microsoft.EntityFrameworkCore.Design", "8.0.0", "net8.0", [(null, [("Microsoft.EntityFrameworkCore.Relational", "[8.0.0]")])]),
1505
+ MockNuGetPackage.CreateSimplePackage("Microsoft.EntityFrameworkCore.Relational", "8.0.0", "net8.0", [(null, [("Microsoft.EntityFrameworkCore", "[8.0.0]")])]),
1506
+ MockNuGetPackage.CreateSimplePackage("Microsoft.EntityFrameworkCore", "8.0.0", "net8.0", [(null, [("Microsoft.EntityFrameworkCore.Analyzers", "[8.0.0]")])]),
1507
+ MockNuGetPackage.CreateSimplePackage("Microsoft.EntityFrameworkCore.Analyzers", "8.0.0", "net8.0")
1508
+ ], tempDirectory.DirectoryPath);
1368
1509
 
1369
1510
  var dependencies = new[]
1370
1511
  {
@@ -1387,13 +1528,14 @@ public class MSBuildHelperTests : TestBase
1387
1528
  new TestLogger()
1388
1529
  );
1389
1530
  Assert.NotNull(resolvedDependencies);
1390
- Assert.Equal(3, resolvedDependencies.Value.Length);
1391
- Assert.Equal("Microsoft.EntityFrameworkCore.Design", resolvedDependencies.Value[0].Name);
1392
- Assert.Equal("8.0.0", resolvedDependencies.Value[0].Version);
1393
- Assert.Equal("Microsoft.EntityFrameworkCore.Relational", resolvedDependencies.Value[1].Name);
1394
- Assert.Equal("8.0.0", resolvedDependencies.Value[1].Version);
1395
- Assert.Equal("Microsoft.EntityFrameworkCore", resolvedDependencies.Value[2].Name);
1396
- Assert.Equal("8.0.0", resolvedDependencies.Value[2].Version);
1531
+ var actualResolvedDependencies = resolvedDependencies.Value.Select(d => $"{d.Name}/{d.Version}").ToArray();
1532
+ var expectedResolvedDependencies = new[]
1533
+ {
1534
+ "Microsoft.EntityFrameworkCore.Design/8.0.0",
1535
+ "Microsoft.EntityFrameworkCore.Relational/8.0.0",
1536
+ "Microsoft.EntityFrameworkCore/8.0.0",
1537
+ };
1538
+ AssertEx.Equal(expectedResolvedDependencies, actualResolvedDependencies);
1397
1539
  }
1398
1540
 
1399
1541
  // Updating a referenced transitive dependency
@@ -1407,17 +1549,26 @@ public class MSBuildHelperTests : TestBase
1407
1549
  var projectPath = Path.Join(tempDirectory.DirectoryPath, "project.csproj");
1408
1550
  await File.WriteAllTextAsync(projectPath, """
1409
1551
  <Project Sdk="Microsoft.NET.Sdk">
1410
- <PropertyGroup>
1552
+ <PropertyGroup>
1411
1553
  <TargetFramework>net8.0</TargetFramework>
1412
- </PropertyGroup>
1413
- <ItemGroup>
1554
+ </PropertyGroup>
1555
+ <ItemGroup>
1414
1556
  <PackageReference Include="System.Collections.Immutable" Version="7.0.0" />
1415
1557
  <PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.8.0" />
1416
1558
  <PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
1417
1559
  <PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.8.0" />
1418
- </ItemGroup>
1560
+ </ItemGroup>
1419
1561
  </Project>
1420
1562
  """);
1563
+ await UpdateWorkerTestBase.MockNuGetPackagesInDirectory([
1564
+ // initial packages
1565
+ MockNuGetPackage.CreateSimplePackage("System.Collections.Immutable", "7.0.0", "net8.0"),
1566
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.CSharp.Workspaces", "4.8.0", "net8.0", [(null, [("Microsoft.CodeAnalysis.CSharp", "[4.8.0]"), ("Microsoft.CodeAnalysis.Common", "[4.8.0]")])]),
1567
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.CSharp", "4.8.0", "net8.0", [(null, [("Microsoft.CodeAnalysis.Common", "[4.8.0]")])]),
1568
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.Common", "4.8.0", "net8.0", [(null, [("System.Collections.Immutable", "7.0.0")])]),
1569
+ // available packages
1570
+ MockNuGetPackage.CreateSimplePackage("System.Collections.Immutable", "8.0.0", "net8.0")
1571
+ ], tempDirectory.DirectoryPath);
1421
1572
 
1422
1573
  var dependencies = new[]
1423
1574
  {
@@ -1441,15 +1592,15 @@ public class MSBuildHelperTests : TestBase
1441
1592
  new TestLogger()
1442
1593
  );
1443
1594
  Assert.NotNull(resolvedDependencies);
1444
- Assert.Equal(4, resolvedDependencies.Value.Length);
1445
- Assert.Equal("System.Collections.Immutable", resolvedDependencies.Value[0].Name);
1446
- Assert.Equal("8.0.0", resolvedDependencies.Value[0].Version);
1447
- Assert.Equal("Microsoft.CodeAnalysis.CSharp.Workspaces", resolvedDependencies.Value[1].Name);
1448
- Assert.Equal("4.8.0", resolvedDependencies.Value[1].Version);
1449
- Assert.Equal("Microsoft.CodeAnalysis.CSharp", resolvedDependencies.Value[2].Name);
1450
- Assert.Equal("4.8.0", resolvedDependencies.Value[2].Version);
1451
- Assert.Equal("Microsoft.CodeAnalysis.Common", resolvedDependencies.Value[3].Name);
1452
- Assert.Equal("4.8.0", resolvedDependencies.Value[3].Version);
1595
+ var actualResolvedDependencies = resolvedDependencies.Value.Select(d => $"{d.Name}/{d.Version}").ToArray();
1596
+ var expectedResolvedDependencies = new[]
1597
+ {
1598
+ "System.Collections.Immutable/8.0.0",
1599
+ "Microsoft.CodeAnalysis.CSharp.Workspaces/4.8.0",
1600
+ "Microsoft.CodeAnalysis.CSharp/4.8.0",
1601
+ "Microsoft.CodeAnalysis.Common/4.8.0",
1602
+ };
1603
+ AssertEx.Equal(expectedResolvedDependencies, actualResolvedDependencies);
1453
1604
  }
1454
1605
 
1455
1606
  // Similar to the last test, with the "grandchild" (System.Collections.Immutable) not in the existing list
@@ -1462,16 +1613,31 @@ public class MSBuildHelperTests : TestBase
1462
1613
  var projectPath = Path.Join(tempDirectory.DirectoryPath, "project.csproj");
1463
1614
  await File.WriteAllTextAsync(projectPath, """
1464
1615
  <Project Sdk="Microsoft.NET.Sdk">
1465
- <PropertyGroup>
1616
+ <PropertyGroup>
1466
1617
  <TargetFramework>net8.0</TargetFramework>
1467
- </PropertyGroup>
1468
- <ItemGroup>
1618
+ </PropertyGroup>
1619
+ <ItemGroup>
1469
1620
  <PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.8.0" />
1470
1621
  <PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
1471
1622
  <PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.8.0" />
1472
- </ItemGroup>
1623
+ </ItemGroup>
1473
1624
  </Project>
1474
1625
  """);
1626
+ await UpdateWorkerTestBase.MockNuGetPackagesInDirectory([
1627
+ // initial packages
1628
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.CSharp.Workspaces", "4.8.0", "net8.0", [(null, [("Microsoft.CodeAnalysis.CSharp", "[4.8.0]"), ("Microsoft.CodeAnalysis.Common", "[4.8.0]")])]),
1629
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.CSharp", "4.8.0", "net8.0", [(null, [("Microsoft.CodeAnalysis.Common", "[4.8.0]")])]),
1630
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.Common", "4.8.0", "net8.0", [(null, [("System.Collections.Immutable", "7.0.0")])]),
1631
+ MockNuGetPackage.CreateSimplePackage("System.Collections.Immutable", "7.0.0", "net8.0"),
1632
+ // available packages
1633
+ MockNuGetPackage.CreateSimplePackage("System.Collections.Immutable", "8.0.0", "net8.0"),
1634
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.CSharp.Workspaces", "4.9.2", "net8.0", [(null, [("Microsoft.CodeAnalysis.CSharp", "[4.9.2]"), ("Microsoft.CodeAnalysis.Common", "[4.9.2]")])]),
1635
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.CSharp", "4.9.2", "net8.0", [(null, [("Microsoft.CodeAnalysis.Common", "[4.9.2]")])]),
1636
+ MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.Common", "4.9.2", "net8.0", [(null, [("System.Collections.Immutable", "8.0.0")])]),
1637
+ //MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.CSharp.Workspaces", "4.10.0", "net8.0", [(null, [("Microsoft.CodeAnalysis.CSharp", "[4.10.0]"), ("Microsoft.CodeAnalysis.Common", "[4.10.0]")])]),
1638
+ //MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.CSharp", "4.10.0", "net8.0", [(null, [("Microsoft.CodeAnalysis.Common", "[4.10.0]")])]),
1639
+ //MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.Common", "4.10.0", "net8.0", [(null, [("System.Collections.Immutable", "8.0.0")])])
1640
+ ], tempDirectory.DirectoryPath);
1475
1641
 
1476
1642
  var dependencies = new[]
1477
1643
  {
@@ -1494,13 +1660,14 @@ public class MSBuildHelperTests : TestBase
1494
1660
  new TestLogger()
1495
1661
  );
1496
1662
  Assert.NotNull(resolvedDependencies);
1497
- Assert.Equal(3, resolvedDependencies.Value.Length);
1498
- Assert.Equal("Microsoft.CodeAnalysis.CSharp.Workspaces", resolvedDependencies.Value[0].Name);
1499
- Assert.Equal("4.9.2", resolvedDependencies.Value[0].Version);
1500
- Assert.Equal("Microsoft.CodeAnalysis.CSharp", resolvedDependencies.Value[1].Name);
1501
- Assert.Equal("4.9.2", resolvedDependencies.Value[1].Version);
1502
- Assert.Equal("Microsoft.CodeAnalysis.Common", resolvedDependencies.Value[2].Name);
1503
- Assert.Equal("4.9.2", resolvedDependencies.Value[2].Version);
1663
+ var actualResolvedDependencies = resolvedDependencies.Value.Select(d => $"{d.Name}/{d.Version}").ToArray();
1664
+ var expectedResolvedDependencies = new[]
1665
+ {
1666
+ "Microsoft.CodeAnalysis.CSharp.Workspaces/4.9.2",
1667
+ "Microsoft.CodeAnalysis.CSharp/4.9.2",
1668
+ "Microsoft.CodeAnalysis.Common/4.9.2",
1669
+ };
1670
+ AssertEx.Equal(expectedResolvedDependencies, actualResolvedDependencies);
1504
1671
  }
1505
1672
  #endregion
1506
1673