public void SdkDependenciesSubTreeProvider_GetDependencyNode()
        {
            // Arrange
            const string packageItemSpec = "MyPackage1";

            var rootNode      = IDependencyNodeFactory.FromJson(@"
{
    ""Id"": {
        ""ProviderType"": ""MyProvider"",
        ""ItemSpec"": ""MyRootNode""
    }
}");
            var existingNode1 = IDependencyNodeFactory.FromJson(@"
{
    ""Id"": {
        ""ProviderType"": ""MyProvider"",
        ""ItemSpec"": ""MyNodeItemSpec1""
    },
    ""Properties"": {
        ""SDKPackageItemSpec"": ""MyPackage1""
    }
}");

            var existingNode2 = IDependencyNodeFactory.FromJson(@"
{
    ""Id"": {
        ""ProviderType"": ""MyProvider"",
        ""ItemSpec"": ""MyNodeItemSpec2""
    },
    ""Properties"": {
    }
}");

            var childNode1 = IDependencyNodeFactory.FromJson(@"
{
    ""Id"": {
        ""ProviderType"": ""MyProvider"",
        ""ItemSpec"": ""MyChildNodeItemSpec1""
    }   
}");

            var childNode2 = IDependencyNodeFactory.FromJson(@"
{
    ""Id"": {
        ""ProviderType"": ""MyProvider"",
        ""ItemSpec"": ""MyChildNodeItemSpec2""
    },
    ""Properties"": {
        ""SDKPackageItemSpec"": ""SomeUnknownPackage""
    }
}");

            rootNode.AddChild(existingNode1);
            rootNode.AddChild(existingNode2);

            var childrenToAdd = new[] { childNode1, childNode2 };

            var nugetPackagesDataProvider =
                INuGetPackagesDataProviderFactory.ImplementUpdateNodeChildren(packageItemSpec, existingNode1, childrenToAdd);

            var provider = new TestableSdkDependenciesSubTreeProvider(nugetPackagesDataProvider);

            provider.SetRootNode(rootNode);

            // Successful scenario
            // Act
            var resultNode = provider.GetDependencyNode(existingNode1.Id);

            // Assert
            Assert.Equal(2, existingNode1.Children.Count);

            // node does not exist in root
            // Act
            resultNode = provider.GetDependencyNode(childNode1.Id);
            // Assert
            Assert.Null(resultNode);

            // node does not have proprty SDKPackageItemSpecProperty
            // Act
            resultNode = provider.GetDependencyNode(existingNode2.Id);
            // Assert
            Assert.Equal(existingNode2, resultNode);
        }
        public async Task SdkDependenciesSubTreeProvider_SearchAsync()
        {
            // Arrange
            const string packageItemSpec = "MyPackage1";

            var existingNode1 = IDependencyNodeFactory.FromJson(@"
{
    ""Id"": {
        ""ProviderType"": ""MyProvider"",
        ""ItemSpec"": ""MyNodeItemSpec1""
    },
    ""Properties"": {
        ""SDKPackageItemSpec"": ""MyPackage1""
    }
}");

            var existingNode2 = IDependencyNodeFactory.FromJson(@"
{
    ""Id"": {
        ""ProviderType"": ""MyProvider"",
        ""ItemSpec"": ""MyNodeItemSpec2""
    },
    ""Properties"": {
    }
}");

            var searchResultNode1 = IDependencyNodeFactory.FromJson(@"
{
    ""Id"": {
        ""ProviderType"": ""MyProvider"",
        ""ItemSpec"": ""MyChildNodeItemSpec1""
    }   
}");

            var searchResultNode2 = IDependencyNodeFactory.FromJson(@"
{
    ""Id"": {
        ""ProviderType"": ""MyProvider"",
        ""ItemSpec"": ""MyChildNodeItemSpec2""
    },
    ""Properties"": {
        ""SDKPackageItemSpec"": ""SomeUnknownPackage""
    }
}");

            var searchResults = new[] { searchResultNode1, searchResultNode2 };

            var nugetPackagesDataProvider =
                INuGetPackagesDataProviderFactory.ImplementSearchAsync(packageItemSpec, "xxx", searchResults);

            var provider = new TestableSdkDependenciesSubTreeProvider(nugetPackagesDataProvider);

            // Successful scenario
            // Act
            var resultNodes = await provider.SearchAsync(existingNode1, "xxx");

            // Assert
            Assert.Equal(2, resultNodes.Count());

            // node does not have proprty SDKPackageItemSpecProperty
            // Act
            resultNodes = await provider.SearchAsync(existingNode2, "xxx");

            // Assert
            Assert.Null(resultNodes);
        }