public void TestInitialize() { List <SUT.MsiProduct> installedProducts = SUT.GetMsiProducts(); if (!Tools.ProductsContains(installedProducts, "26A24AE4-039D-4CA4-87B4-2F32180121F0")) { Tools.InstallJava(@"C:\Users\Courtel\Downloads\Java\jre-8u121-windows-i586.exe"); } if (!Tools.ProductsContains(installedProducts, "26A24AE4-039D-4CA4-87B4-2F32180131F0")) { Tools.InstallJava(@"C:\Users\Courtel\Downloads\Java\jre-8u131-windows-i586.exe"); } if (!Tools.ProductsContains(installedProducts, "26A24AE4-039D-4CA4-87B4-2F32180144F0")) { Tools.InstallJava(@"C:\Users\Courtel\Downloads\Java\jre-8u144-windows-i586.exe"); } if (!Tools.ProductsContains(installedProducts, "26A24AE4-039D-4CA4-87B4-2F32180152F0")) { Tools.InstallJava(@"C:\Users\Courtel\Downloads\Java\jre-8u152-windows-i586.exe"); } installedProducts = SUT.GetMsiProducts(); Assert.IsTrue(Tools.ProductsContains(installedProducts, "26A24AE4-039D-4CA4-87B4-2F32180121F0")); Assert.IsTrue(Tools.ProductsContains(installedProducts, "26A24AE4-039D-4CA4-87B4-2F32180131F0")); Assert.IsTrue(Tools.ProductsContains(installedProducts, "26A24AE4-039D-4CA4-87B4-2F32180144F0")); Assert.IsTrue(Tools.ProductsContains(installedProducts, "26A24AE4-039D-4CA4-87B4-2F32180152F0")); }
public void TestInitialize() { List <CU.MsiProduct> installedProducts = CU.GetMsiProducts(); if (Tools.ProductsContains(installedProducts, "D0A41530-E762-4C7D-8A72-E2D0E07C8A2E")) { CU action = new CU(Tools.GetXmlFragment("UnInstallRemoteMsiManager.custAct")); var finalResult = Tools.GetReturnCodeAction(); action.Run(ref finalResult); installedProducts = CU.GetMsiProducts(); Assert.IsFalse(Tools.ProductsContains(installedProducts, "D0A41530-E762-4C7D-8A72-E2D0E07C8A2E")); } }
public void InstallRemoteMsiManager_WhenAskedToDoSo() { // Arrange SUT action = new SUT(Tools.GetXmlFragment("Install Remote Msi Manager.CustAct")); var finalResult = Tools.GetReturnCodeAction(); // Act List <CU.MsiProduct> installedProducts = CU.GetMsiProducts(); action.Run(ref finalResult); installedProducts = CU.GetMsiProducts(); // Assert Assert.IsTrue(Tools.ProductsContains(installedProducts, "D0A41530-E762-4C7D-8A72-E2D0E07C8A2E")); Assert.AreEqual(0, finalResult.ReturnValue); }
public void UninstallOneProduct_WhenOnlyOneProductMatch() { // Arrange SUT action = new SUT(Tools.GetXmlFragment("UninstallMsiByGuid-OneProduct.CustAct")); var finalResult = Tools.GetReturnCodeAction(); List <SUT.MsiProduct> installedProducts = SUT.GetMsiProducts(); int productCountBefore = installedProducts.Count; int productCountAfter; // Act action.Run(ref finalResult); installedProducts = SUT.GetMsiProducts(); productCountAfter = installedProducts.Count; // Asset Assert.IsFalse(Tools.ProductsContains(installedProducts, "26A24AE4-039D-4CA4-87B4-2F32180121F0")); Assert.IsTrue(productCountBefore == productCountAfter + 1); }
public void UninstallAllJavaExceptU152_WhenPatternMatchAllAndExceptionListU152() { // Arrange SUT action = new SUT(Tools.GetXmlFragment("UninstallMsiByGuid-AllJavaExceptU152.CustAct")); var finalResult = Tools.GetReturnCodeAction(); List <SUT.MsiProduct> installedProducts = SUT.GetMsiProducts(); int productCountBefore = installedProducts.Count; int productCountAfter; // Act action.Run(ref finalResult); installedProducts = SUT.GetMsiProducts(); productCountAfter = installedProducts.Count; // Asset Assert.IsFalse(Tools.ProductsContains(installedProducts, "26A24AE4-039D-4CA4-87B4-2F32180121F0")); Assert.IsFalse(Tools.ProductsContains(installedProducts, "26A24AE4-039D-4CA4-87B4-2F32180131F0")); Assert.IsFalse(Tools.ProductsContains(installedProducts, "26A24AE4-039D-4CA4-87B4-2F32180144F0")); Assert.IsTrue(productCountBefore == productCountAfter + 3); }
public void UninstallNothing_WhenPatternDoesNotMatchAnything() { // Arrange SUT action = new SUT(Tools.GetXmlFragment("UninstallMsiByGuid-PatternDoesNotMatchanything.CustAct")); var finalResult = Tools.GetReturnCodeAction(); List <SUT.MsiProduct> installedProducts = SUT.GetMsiProducts(); int productCountBefore = installedProducts.Count; int productCountAfter; // Act action.Run(ref finalResult); installedProducts = SUT.GetMsiProducts(); productCountAfter = installedProducts.Count; // Asset Assert.IsTrue(Tools.ProductsContains(installedProducts, "26A24AE4-039D-4CA4-87B4-2F32180121F0")); Assert.IsTrue(Tools.ProductsContains(installedProducts, "26A24AE4-039D-4CA4-87B4-2F32180131F0")); Assert.IsTrue(Tools.ProductsContains(installedProducts, "26A24AE4-039D-4CA4-87B4-2F32180144F0")); Assert.IsTrue(Tools.ProductsContains(installedProducts, "26A24AE4-039D-4CA4-87B4-2F32180152F0")); Assert.IsTrue(productCountBefore == productCountAfter); }