blob: b883db7b7fd305fb0db65705f60a38bfccfc1881 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
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;
namespace Tango.UnitTesting.AdvancedInstaller
{
[TestClass]
[TestCategory("Advanced Installer")]
public class AdvancedInstaller_TST
{
[TestMethod]
public void Build_Install_Verify()
{
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();
String product_name = builder.GetProperty(ProjectProperty.ProductName).Result;
String manufacturer = builder.GetProperty(ProjectProperty.Manufacturer).Result;
var output_file = output_folder + "\\" + product_name + " Installer_v2.0.0.msi";
builder.Build("2.0.0", output_file).Wait();
File.Delete(added_file);
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);
}
}
}
|