public void ItWillNotRemoveTheProviderIfOtherDependentsExist() { DependencyProvider dep = new DependencyProvider(".NET_SDK_TEST_PROVIDER_KEY", allUsers: false); try { // Write multiple dependents dep.AddDependent(DependencyProvider.VisualStudioDependentKeyName); dep.AddDependent("Microsoft.NET.SDK,v6.0.100"); Assert.Equal(2, dep.Dependents.Count()); dep.RemoveDependent("Microsoft.NET.SDK,v6.0.100", removeProvider: true); Assert.True(dep.HasVisualStudioDependency); } finally { DeleteProviderKey(dep); } }
public void ItWillNotRemoveTheProviderIfOtherDependentsExist() { DependencyProvider dep = new DependencyProvider(".NET_SDK_TEST_PROVIDER_KEY", allUsers: false); try { // Write multiple dependents dep.AddDependent(DependencyProvider.VisualStudioDependentKeyName); dep.AddDependent("Microsoft.NET.SDK,v6.0.100"); Assert.Equal(2, dep.Dependents.Count()); dep.RemoveDependent("Microsoft.NET.SDK,v6.0.100", removeProvider: true); Assert.True(dep.HasVisualStudioDependency); } finally { // Clean up and delete everything using RegistryKey providerKey = dep.BaseKey.OpenSubKey(DependencyProvider.DependenciesKeyRelativePath, writable: true); providerKey?.DeleteSubKeyTree(dep.ProviderKeyName); } }
public void ItCanFindVisualStudioDependents() { DependencyProvider dep = new DependencyProvider(".NET_SDK_TEST_PROVIDER_KEY", allUsers: false); try { // We should not have any dependents Assert.Empty(dep.Dependents); // Write the VS dependents key dep.AddDependent(DependencyProvider.VisualStudioDependentKeyName); Assert.True(dep.HasVisualStudioDependency); } finally { DeleteProviderKey(dep); } }
public void ItCanAddDependents() { // We cannot create per-machine entries unless the tests run elevated. The results are the // the same, it's only the base key that's different DependencyProvider dep = new DependencyProvider(".NET_SDK_TEST_PROVIDER_KEY", allUsers: false); try { // We should not have any dependents Assert.Empty(dep.Dependents); dep.AddDependent("Microsoft.NET.SDK,v6.0.100"); Assert.Single(dep.Dependents); Assert.Equal("Microsoft.NET.SDK,v6.0.100", dep.Dependents.First()); } finally { DeleteProviderKey(dep); } }
public void ItCanFindVisualStudioDependents() { DependencyProvider dep = new DependencyProvider(".NET_SDK_TEST_PROVIDER_KEY", allUsers: false); try { // We should not have any dependents Assert.Empty(dep.Dependents); // Write the VS dependents key dep.AddDependent(DependencyProvider.VisualStudioDependentKeyName); Assert.True(dep.HasVisualStudioDependency); } finally { // Clean up and delete everything using RegistryKey providerKey = dep.BaseKey.OpenSubKey(DependencyProvider.DependenciesKeyRelativePath, writable: true); providerKey?.DeleteSubKeyTree(dep.ProviderKeyName); } }
public void ItCanAddDependents() { // We cannot create per-machine entries unless the tests run elevated. The results are the // the same, it's only the base key that's different DependencyProvider dep = new DependencyProvider(".NET_SDK_TEST_PROVIDER_KEY", allUsers: false); try { // We should not have any dependents Assert.Empty(dep.Dependents); dep.AddDependent("Microsoft.NET.SDK,v6.0.100"); Assert.Single(dep.Dependents); Assert.Equal("Microsoft.NET.SDK,v6.0.100", dep.Dependents.First()); } finally { // Clean up and delete everything using RegistryKey providerKey = dep.BaseKey.OpenSubKey(DependencyProvider.DependenciesKeyRelativePath, writable: true); providerKey?.DeleteSubKeyTree(dep.ProviderKeyName); } }