From 08d9858ecd0d4adb0c9c6076d7d2b1216e8f64c3 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 25 Feb 2019 16:03:14 +0200 Subject: Completed advanced installer lib + unit test. --- .../AdvancedInstaller/AdvancedInstaller_TST.cs | 43 ++++++++++++++++----- .../DemoProject/DemoProject-cache/cacheIndex.txt | Bin 0 -> 52 bytes .../DemoProject/DemoProject-cache/part1/disk1.cab | Bin 0 -> 147 bytes .../DemoProject-cache/part1/output-info.ini | Bin 0 -> 1470 bytes .../AdvancedInstaller/DemoProject/DemoProject.aip | 8 ++-- .../DemoProject/Setup Files/DemoProject.msi | Bin 0 -> 518656 bytes .../Tango.UnitTesting/Tango.UnitTesting.csproj | 4 +- 7 files changed, 40 insertions(+), 15 deletions(-) create mode 100644 Software/Visual_Studio/Tango.UnitTesting/AdvancedInstaller/DemoProject/DemoProject-cache/cacheIndex.txt create mode 100644 Software/Visual_Studio/Tango.UnitTesting/AdvancedInstaller/DemoProject/DemoProject-cache/part1/disk1.cab create mode 100644 Software/Visual_Studio/Tango.UnitTesting/AdvancedInstaller/DemoProject/DemoProject-cache/part1/output-info.ini create mode 100644 Software/Visual_Studio/Tango.UnitTesting/AdvancedInstaller/DemoProject/Setup Files/DemoProject.msi (limited to 'Software/Visual_Studio/Tango.UnitTesting') diff --git a/Software/Visual_Studio/Tango.UnitTesting/AdvancedInstaller/AdvancedInstaller_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/AdvancedInstaller/AdvancedInstaller_TST.cs index 60a047c0c..b883db7b7 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/AdvancedInstaller/AdvancedInstaller_TST.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/AdvancedInstaller/AdvancedInstaller_TST.cs @@ -5,6 +5,7 @@ using System.Diagnostics; using System.IO; using System.Linq; using System.Text; +using System.Threading; using System.Threading.Tasks; using Tango.AdvancedInstaller; using Tango.Core.IO; @@ -16,30 +17,52 @@ namespace Tango.UnitTesting.AdvancedInstaller public class AdvancedInstaller_TST { [TestMethod] - public void Set_Version_and_Package_name_And_Build() + public void Build_Install_Verify() { - InstallerBuilder builder = new InstallerBuilder(); - var demo_project_path = Directory.GetCurrentDirectory() + "\\AdvancedInstaller\\DemoProject"; var project_Path = Path.Combine(demo_project_path, "DemoProject.aip"); var files_path = Path.Combine(demo_project_path, "Files"); var added_file = files_path + "\\addedFile.txt"; + InstallerBuilder builder = new InstallerBuilder(project_Path); + File.WriteAllText(added_file, "Added File!"); var output_folder = TemporaryManager.Default.CreateFolder(); - builder.ProjectFile = project_Path; - builder.OutputFolder = output_folder; - builder.ProductName = "TEST TEST TEST"; - builder.ProductVersion = "2.0.0.0"; - builder.PackageType = PackageType.MSI; + String product_name = builder.GetProperty(ProjectProperty.ProductName).Result; + String manufacturer = builder.GetProperty(ProjectProperty.Manufacturer).Result; - builder.Build().Wait(); + var output_file = output_folder + "\\" + product_name + " Installer_v2.0.0.msi"; + + builder.Build("2.0.0", output_file).Wait(); File.Delete(added_file); - output_folder.Display(); + Assert.IsTrue(File.Exists(output_file)); + + var process = Process.Start(output_file); + process.WaitForExit(); + + File.Delete(output_file); + + String installationFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), manufacturer, product_name); + + Assert.IsTrue(File.Exists(Path.Combine(installationFolder, Path.GetFileName(added_file)))); + + Thread.Sleep(2000); + + bool installed = builder.IsInstalled().Result; + + Assert.IsTrue(installed); + + builder.Uninstall().Wait(); + + Thread.Sleep(2000); + + installed = builder.IsInstalled().Result; + + Assert.IsFalse(installed); } } } diff --git a/Software/Visual_Studio/Tango.UnitTesting/AdvancedInstaller/DemoProject/DemoProject-cache/cacheIndex.txt b/Software/Visual_Studio/Tango.UnitTesting/AdvancedInstaller/DemoProject/DemoProject-cache/cacheIndex.txt new file mode 100644 index 000000000..5fe5afe5a Binary files /dev/null and b/Software/Visual_Studio/Tango.UnitTesting/AdvancedInstaller/DemoProject/DemoProject-cache/cacheIndex.txt differ diff --git a/Software/Visual_Studio/Tango.UnitTesting/AdvancedInstaller/DemoProject/DemoProject-cache/part1/disk1.cab b/Software/Visual_Studio/Tango.UnitTesting/AdvancedInstaller/DemoProject/DemoProject-cache/part1/disk1.cab new file mode 100644 index 000000000..c376f83d7 Binary files /dev/null and b/Software/Visual_Studio/Tango.UnitTesting/AdvancedInstaller/DemoProject/DemoProject-cache/part1/disk1.cab differ diff --git a/Software/Visual_Studio/Tango.UnitTesting/AdvancedInstaller/DemoProject/DemoProject-cache/part1/output-info.ini b/Software/Visual_Studio/Tango.UnitTesting/AdvancedInstaller/DemoProject/DemoProject-cache/part1/output-info.ini new file mode 100644 index 000000000..3586cb103 Binary files /dev/null and b/Software/Visual_Studio/Tango.UnitTesting/AdvancedInstaller/DemoProject/DemoProject-cache/part1/output-info.ini differ diff --git a/Software/Visual_Studio/Tango.UnitTesting/AdvancedInstaller/DemoProject/DemoProject.aip b/Software/Visual_Studio/Tango.UnitTesting/AdvancedInstaller/DemoProject/DemoProject.aip index a4889c4c0..10abc0933 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/AdvancedInstaller/DemoProject/DemoProject.aip +++ b/Software/Visual_Studio/Tango.UnitTesting/AdvancedInstaller/DemoProject/DemoProject.aip @@ -5,8 +5,10 @@ - + + + @@ -101,7 +103,7 @@ - + @@ -137,6 +139,6 @@ - + diff --git a/Software/Visual_Studio/Tango.UnitTesting/AdvancedInstaller/DemoProject/Setup Files/DemoProject.msi b/Software/Visual_Studio/Tango.UnitTesting/AdvancedInstaller/DemoProject/Setup Files/DemoProject.msi new file mode 100644 index 000000000..9803733dc Binary files /dev/null and b/Software/Visual_Studio/Tango.UnitTesting/AdvancedInstaller/DemoProject/Setup Files/DemoProject.msi differ diff --git a/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj b/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj index 357a2344b..4e852fed8 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj +++ b/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj @@ -118,7 +118,7 @@ - PreserveNewest + Always @@ -242,7 +242,7 @@ - + \ No newline at end of file -- cgit v1.3.1