public async Task OnInputsChangedAsync_NullAsRestoreInfo_DoesNotPushToRestoreService()
        {
            int callCount = 0;
            var solutionRestoreService = IVsSolutionRestoreServiceFactory.ImplementNominateProjectAsync((projectFile, info, cancellationToken) => { callCount++; });

            var instance = await CreateInitializedInstance(solutionRestoreService : solutionRestoreService);

            var value = IProjectVersionedValueFactory.Create(new PackageRestoreUnconfiguredInput(null, new PackageRestoreConfiguredInput[0]));

            await instance.OnInputsChangedAsync(value);

            Assert.Equal(0, callCount);
        }
Exemplo n.º 2
0
        public async Task OnRestoreInfoChangedAsync_NullAsValue_DoesNotPushToRestoreService()
        {
            int callCount = 0;
            var solutionRestoreService = IVsSolutionRestoreServiceFactory.ImplementNominateProjectAsync((projectFile, info, cancellationToken) => { callCount++; });

            var instance = await CreateInitializedInstance(solutionRestoreService : solutionRestoreService);

            var value = IProjectVersionedValueFactory.Create <IVsProjectRestoreInfo2>(null);

            await instance.OnRestoreInfoChangedAsync(value);

            Assert.Equal(0, callCount);
        }
        public async Task OnInputsChangedAsync_UnchangedValueAsValue_DoesNotPushToRestoreService()
        {
            int callCount = 0;
            var solutionRestoreService = IVsSolutionRestoreServiceFactory.ImplementNominateProjectAsync((projectFile, info, cancellationToken) => { callCount++; });

            var instance = await CreateInitializedInstance(solutionRestoreService : solutionRestoreService);

            var restoreInfo = ProjectRestoreInfoFactory.Create();
            var value       = IProjectVersionedValueFactory.Create(new PackageRestoreUnconfiguredInput(restoreInfo, new PackageRestoreConfiguredInput[0]));

            await instance.OnInputsChangedAsync(value);

            Assert.Equal(1, callCount); // Should have only been called once
        }
        public async Task OnInputsChangedAsync_PushesRestoreInfoToRestoreService()
        {
            IVsProjectRestoreInfo2?result = null;
            var solutionRestoreService    = IVsSolutionRestoreServiceFactory.ImplementNominateProjectAsync((projectFile, info, cancellationToken) => { result = info; });

            var instance = await CreateInitializedInstance(solutionRestoreService : solutionRestoreService);

            var restoreInfo = ProjectRestoreInfoFactory.Create();
            var value       = IProjectVersionedValueFactory.Create(new PackageRestoreUnconfiguredInput(restoreInfo, new PackageRestoreConfiguredInput[0]));

            await instance.OnInputsChangedAsync(value);

            Assert.Same(restoreInfo, result);
        }