public void NuGetDependenciesSubTreeProvider_DependenciesSnapshot_UpdateDependency() { var provider = new TestableNuGetDependenciesSubTreeProvider(); var snapshotJson = @" { ""NodesCache"": [ { ""Id"": { ""ProviderType"": ""NuGetDependency"", ""ItemSpec"": ""tfm1/Package2/1.0.0"", ""ItemType"": ""PackageReference"" } } ], ""DependenciesWorld"": [ { ""ItemSpec"": ""tfm1/Package2/1.0.0"", ""Properties"": { ""Name"": ""Package2"", ""Version"": ""1.0.0"", ""Type"": ""Package"", ""Path"": ""SomePath"", ""Resolved"": ""true"", ""Dependencies"": ""Package3/2.0.0;NotExistentPackage/2.0.0;Assembly1/1.0.0;FrameworkAssembly1/4.0.0;SomeUnknown/1.0.0"" } } ] }"; provider.LoadSnapshotFromJson(snapshotJson); // Add a dependency var sampleDependencyProperties = new Dictionary <string, string> { { "Name", "Package2" }, { "Version", "3.0.0" } }.ToImmutableDictionary(); var itemsSpec = "tfm1/Package2/1.0.0"; // Act provider.UpdateDependencyInSnapshot(itemsSpec, sampleDependencyProperties); // Assert // check node was updated var resultVersion = provider.GetCurrentSnapshotDependencyProperty( itemsSpec, "Version"); Assert.Equal("3.0.0", resultVersion); // check node was removed form cache Assert.False(provider.GetCurrentSnapshotNodesCache().Any(x => x.Equals(itemsSpec))); }