public void AddPackage_PackageRepositoryIsOperationAwareAndPackageAddedSuccessfully_InstallOperationStartedForPackage()
        {
            CreateViewModel();
            var operationAwareRepository = new FakeOperationAwarePackageRepository();

            fakePackage.FakePackageRepository = operationAwareRepository;
            fakePackage.Id = "MyPackage";

            viewModel.AddPackage();

            operationAwareRepository.AssertOperationWasStartedAndDisposed(RepositoryOperationNames.Install, "MyPackage");
        }
        public void ManagePackage_TwoProjectsNeitherSelectedAndSourceRepositoryIsOperationAware_InstallOperationStarted()
        {
            CreateViewModelWithTwoProjectsSelected("Project A", "Project B");
            UserAcceptsProjectSelection();
            var operationAwareRepository = new FakeOperationAwarePackageRepository();

            fakePackage.FakePackageRepository = operationAwareRepository;
            fakePackage.Id = "MyPackage";

            viewModel.ManagePackage();

            operationAwareRepository.AssertOperationWasStartedAndDisposed(RepositoryOperationNames.Install, "MyPackage");
        }
Example #3
0
        public void ProcessRecord_PackageIdAndProjectNameSpecifiedSpecifiedAndSourceRepositoryIsOperationAware_UpdateOperationStartedAndDisposedForPackage()
        {
            CreateCmdletWithActivePackageSourceAndProject();
            SetProjectNameParameter("TestProject");
            SetIdParameter("Test");
            var operationAwareRepository = new FakeOperationAwarePackageRepository();

            fakeProject.FakeSourceRepository = operationAwareRepository;

            RunCmdlet();

            operationAwareRepository.AssertOperationWasStartedAndDisposed(RepositoryOperationNames.Update, "Test");
        }
Example #4
0
        public void ProcessRecord_SourceRepositoryIsOperationAware_InstallOperationStartedForPackageAndDisposed()
        {
            CreateCmdletWithoutActiveProject();
            AddDefaultProjectToConsoleHost();
            var operationAwareRepository = new FakeOperationAwarePackageRepository();

            fakeConsoleHost.FakeProject.FakeSourceRepository = operationAwareRepository;
            AddPackageSourceToConsoleHost();
            SetIdParameter("Test");

            RunCmdlet();

            operationAwareRepository.AssertOperationWasStartedAndDisposed(RepositoryOperationNames.Install, "Test");
        }
Example #5
0
        public void ProcessRecord_UpdateAllPackagesIsSolutionAndTwoUpdateActionsAndSourceRepositoryIsOperationAware_UpdateOperationStartedAndDisposedForSecondPackage()
        {
            CreateCmdletWithoutActiveProject();
            AddDefaultProjectToConsoleHost();
            AddPackageSourceToConsoleHost();
            CreateUpdateActionWhenUpdatingAllPackagesInSolution("Test1");
            FakeUpdatePackageAction action = CreateUpdateActionWhenUpdatingAllPackagesInSolution("Test2");
            var operationAwareRepository   = new FakeOperationAwarePackageRepository();

            action.FakeProject.FakeSourceRepository = operationAwareRepository;

            RunCmdlet();

            operationAwareRepository.AssertOperationWasStartedAndDisposed(RepositoryOperationNames.Update, "Test2");
        }
Example #6
0
        public void ProcessRecord_PackageIdSpecifiedAndSourceRepositoryIsOperationAware_UpdateOperationStartedAndDisposedForPackage()
        {
            CreateCmdletWithoutActiveProject();
            AddDefaultProjectToConsoleHost();
            AddPackageSourceToConsoleHost();
            SetIdParameter("Test");
            FakeUpdatePackageAction action = CreateUpdateActionWhenUpdatingPackageInAllProjects("Test");
            var operationAwareRepository   = new FakeOperationAwarePackageRepository();

            action.FakeProject.FakeSourceRepository = operationAwareRepository;

            RunCmdlet();

            operationAwareRepository.AssertOperationWasStartedAndDisposed(RepositoryOperationNames.Update, "Test");
        }
Example #7
0
        public void ProcessRecord_ReinstallWhenPackageIdAndProjectNameSpecifiedAndSourceRepositoryIsOperationAware_ReinstallOperationStartedAndDisposedForPackage()
        {
            CreateCmdletWithActivePackageSourceAndProject();
            SetIdParameter("Test");
            SetProjectNameParameter("MyProject");
            fakeProject.FakeLocalRepository.AddFakePackage("Test");
            var operationAwareRepository = new FakeOperationAwarePackageRepository();

            fakeProject.FakeSourceRepository = operationAwareRepository;
            cmdlet.Reinstall = true;

            RunCmdlet();

            operationAwareRepository.AssertOperationWasStartedAndDisposed(RepositoryOperationNames.Reinstall, "Test");
        }
        public void UpdateAllPackagesCommand_SourceRepositoryIsOperationAware_UpdateOperationStartedAndDisposed()
        {
            CreateViewModel();
            var operationAwareRepository = new FakeOperationAwarePackageRepository();

            registeredPackageRepositories.FakeActiveRepository = operationAwareRepository;
            AddPackageToLocalRepository("Test", "1.0.0.0");
            AddPackageToActiveRepository("Test", "1.0.0.0");
            FakePackage newerPackage = AddPackageToActiveRepository("Test", "1.1.0.0");

            viewModel.ReadPackages();
            CompleteReadPackagesTask();

            RunUpdateAllPackagesCommand();

            operationAwareRepository.AssertOperationWasStartedAndDisposed(RepositoryOperationNames.Update, null);
        }
Example #9
0
        public void Execute_ProjectHasOneUnrestoredPackage_RestoreOperationAddedToHttpHeader()
        {
            FakePackageManagementProject project = CreateSolutionWithOneProject();

            project.AddPackageReference("MyPackage", "1.0");
            FakeOperationAwarePackageRepository repository = MakePriorityRepositoryOperationAware();

            AddPackageToPriorityRepository("MyPackage", "1.0");
            CreateAction();

            action.Execute();

            repository.AssertOperationWasStartedAndDisposed(
                RepositoryOperationNames.Restore,
                "MyPackage",
                "1.0");
        }