private async Task InitializeAsync() { _lazySettings = new AsyncLazy <ISettings>(ServiceLocator.GetInstanceAsync <ISettings>, ThreadHelper.JoinableTaskFactory); _lazySolutionManager = new AsyncLazy <IVsSolutionManager>(ServiceLocator.GetInstanceAsync <IVsSolutionManager>, ThreadHelper.JoinableTaskFactory); _projectManagerServiceSharedState = new NuGetProjectManagerServiceState(); _sharedServiceState = await SharedServiceState.CreateAsync(CancellationToken.None); }
public async Task GetPackageManagerAsync_Always_ReturnsNewInstance() { using (SharedServiceState state = await SharedServiceState.CreateAsync(CancellationToken.None)) { NuGetPackageManager packageManager0 = await state.GetPackageManagerAsync(CancellationToken.None); NuGetPackageManager packageManager1 = await state.GetPackageManagerAsync(CancellationToken.None); NuGetPackageManager packageManager2 = await state.GetPackageManagerAsync(CancellationToken.None); Assert.NotNull(packageManager0); Assert.NotNull(packageManager1); Assert.NotNull(packageManager2); Assert.NotSame(packageManager0, packageManager1); Assert.NotSame(packageManager0, packageManager2); } }