public PackageOperation AddOneFakeUninstallPackageOperation () { var package = new FakePackage ("PackageToUninstall"); var operation = new FakePackageOperation (package, PackageAction.Uninstall); FakeSolution.FakeProjectToReturnFromGetProject.FakeInstallOperations.Add (operation); return operation; }
public FakePackageOperation AddFakeUninstallOperation() { var package = new FakePackage("MyPackage"); var operation = new FakePackageOperation(package, PackageAction.Uninstall); FakeInstallOperations.Add(operation); return(operation); }
public PackageOperation AddOneFakeUninstallPackageOperation() { var package = new FakePackage("PackageToUninstall"); var operation = new FakePackageOperation(package, PackageAction.Uninstall); FakeSolution.FakeProjectToReturnFromGetProject.FakeInstallOperations.Add(operation); return(operation); }
public PackageOperation AddOneFakeInstallPackageOperationForViewModelPackage() { var operation = new FakePackageOperation(FakePackage, PackageAction.Install); FakeSolution .FakeProjectToReturnFromGetProject .FakeInstallOperations .Add(operation); return(operation); }
public PackageOperation AddOneFakeInstallPackageOperationForViewModelPackage () { var operation = new FakePackageOperation (FakePackage, PackageAction.Install); FakeSolution .FakeProjectToReturnFromGetProject .FakeInstallOperations .Add (operation); return operation; }
public void Execute_PackageBeingInstalledHasPowerShellScripts_WarningAboutPowerShellScriptsIsLogged () { CreateAction (); FakePackage expectedPackage = fakeProject.FakeSourceRepository.AddFakePackageWithVersion ("Test", "1.0"); expectedPackage.AddFile (@"tools\init.ps1"); var operation = new FakePackageOperation (expectedPackage, PackageAction.Install); action.PackageId = expectedPackage.Id; action.PackageVersion = expectedPackage.Version; fakeProject.FakeInstallOperations.Add (operation); string messageLogged = null; packageManagementEvents.PackageOperationMessageLogged += (sender, e) => { if (e.Message.Level == MessageLevel.Warning) { messageLogged = e.Message.ToString (); } }; action.Execute (); Assert.AreEqual ("Test Package contains PowerShell scripts which will not be run.", messageLogged); }
public void Execute_ProjectHasOnePackageInstallOperationThatHasALicenseToBeAcceptedAndLicensesNotAccepted_ExceptionThrown () { CreateAction (); FakePackage expectedPackage = fakeProject.FakeSourceRepository.AddFakePackageWithVersion ("Test", "1.0"); expectedPackage.RequireLicenseAcceptance = true; var operation = new FakePackageOperation (expectedPackage, PackageAction.Install); action.PackageId = expectedPackage.Id; action.PackageVersion = expectedPackage.Version; fakeProject.FakeInstallOperations.Add (operation); packageManagementEvents.AcceptLicenses += (sender, e) => { e.IsAccepted = false; }; Exception ex = Assert.Throws (typeof(ApplicationException), () => action.Execute ()); Assert.AreEqual ("Licenses not accepted.", ex.Message); }
public void Execute_ProjectHasOnePackageInstallOperationThatHasALicenseToBeAcceptedButPackageInstalledAlready_NoAcceptLicensesEventIsRaised () { CreateAction (); FakePackage expectedPackage = fakeProject.FakeSourceRepository.AddFakePackageWithVersion ("Test", "1.0"); expectedPackage.RequireLicenseAcceptance = true; var operation = new FakePackageOperation (expectedPackage, PackageAction.Install); action.PackageId = expectedPackage.Id; action.PackageVersion = expectedPackage.Version; fakeProject.FakeInstallOperations.Add (operation); fakeProject.FakePackages.Add (expectedPackage); bool acceptLicensesEventRaised = false; packageManagementEvents.AcceptLicenses += (sender, e) => { acceptLicensesEventRaised = true; }; action.Execute (); Assert.IsFalse (acceptLicensesEventRaised); }
public void Execute_ProjectHasOnePackageInstallOperationThatHasALicenseToBeAccepted_AcceptLicensesEventRaised () { CreateAction (); FakePackage expectedPackage = fakeProject.FakeSourceRepository.AddFakePackageWithVersion ("Test", "1.0"); expectedPackage.RequireLicenseAcceptance = true; var expectedPackages = new IPackage [] { expectedPackage }; var operation = new FakePackageOperation (expectedPackage, PackageAction.Install); action.PackageId = expectedPackage.Id; action.PackageVersion = expectedPackage.Version; fakeProject.FakeInstallOperations.Add (operation); List<IPackage> actualPackages = null; packageManagementEvents.AcceptLicenses += (sender, e) => { e.IsAccepted = true; actualPackages = e.Packages.ToList (); }; action.Execute (); PackageCollectionAssert.AreEqual (expectedPackages, actualPackages); }
public void HasPackageScriptsToRun_ProjectHasOnePackageOperation_PackageLocated () { CreateAction (); FakePackage expectedPackage = fakeProject.FakeSourceRepository.AddFakePackageWithVersion ("Test", "1.0"); var operation = new FakePackageOperation (expectedPackage, PackageAction.Install); action.PackageId = expectedPackage.Id; action.PackageVersion = expectedPackage.Version; fakeProject.FakeInstallOperations.Add (operation); action.HasPackageScriptsToRun (); IPackage actualPackage = action.Package; Assert.AreEqual (expectedPackage, actualPackage); }
public void HasPackageScriptsToRun_ProjectHasOnePackageOperation_DoesNotThrowNullReferenceException () { CreateAction (); FakePackage package = fakeProject.FakeSourceRepository.AddFakePackageWithVersion ("Test", "1.0"); var operation = new FakePackageOperation (package, PackageAction.Install); action.PackageId = package.Id; action.PackageVersion = package.Version; fakeProject.FakeInstallOperations.Add (operation); Assert.DoesNotThrow (() => action.HasPackageScriptsToRun ()); }
public FakePackageOperation AddFakeUninstallOperation () { var package = new FakePackage ("MyPackage"); var operation = new FakePackageOperation (package, PackageAction.Uninstall); FakeInstallOperations.Add (operation); return operation; }
public void Execute_PackageBeingInstalledHasPowerShellScripts_MessageAboutPowerShellScriptsIsLogged () { CreateAction (); FakePackage expectedPackage = fakeProject.FakeSourceRepository.AddFakePackageWithVersion ("Test", "1.0"); expectedPackage.AddFile (@"tools\init.ps1"); var operation = new FakePackageOperation (expectedPackage, PackageAction.Install); action.PackageId = expectedPackage.Id; action.PackageVersion = expectedPackage.Version; fakeProject.FakeInstallOperations.Add (operation); var messagesLogged = new List<string> (); packageManagementEvents.PackageOperationMessageLogged += (sender, e) => { if (e.Message.Level == MessageLevel.Info) { messagesLogged.Add (e.Message.ToString ()); } }; action.Execute (); Assert.That (messagesLogged, Contains.Item ("WARNING: Test Package contains PowerShell scripts which will not be run.")); }