aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Web/Tango.MachineService/App_Start/WebApiConfig.cs
blob: 73265328c7566d165188b854e03ba595e05abf51 (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
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
using Tango.Web.Formatters;

namespace Tango.MachineService
{
    public static class WebApiConfig
    {
        public static void Register(HttpConfiguration config)
        {
            // Web API configuration and services

            // Web API routes
            config.MapHttpAttributeRoutes();

            config.Routes.MapHttpRoute(
            name: "API Default",
            routeTemplate: "api/{controller}/{action}/{id}",
            defaults: new { id = RouteParameter.Optional });

            config.Formatters.Insert(0, new ProtoBufFormatter());
            //config.Formatters.Insert(1, new JsonNetFormatter(new JsonSerializerSettings()
            //{
            //    PreserveReferencesHandling = PreserveReferencesHandling.All,
            //}));
        }
    }
}
an class="n">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); } } }