Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Tests/InstallationManagerTest.cs @ 6427

Last change on this file since 6427 was 6427, checked in by gkronber, 13 years ago

#1537: implemented unit test to check if the connection to the update service works.

File size: 3.6 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using HeuristicLab.PluginInfrastructure.Advanced;
23using Microsoft.VisualStudio.TestTools.UnitTesting;
24using System;
25using System.Linq;
26using HeuristicLab.PluginInfrastructure;
27using System.Collections.Generic;
28using HeuristicLab.PluginInfrastructure.Advanced.DeploymentService;
29
30namespace HeuristicLab.PluginInfrastructure_3._3.Test {
31
32
33  /// <summary>
34  ///This is a test class for InstallationManagerTest and is intended
35  ///to contain all InstallationManagerTest Unit Tests
36  ///</summary>
37  [TestClass()]
38  public class InstallationManagerTest {
39
40
41    private TestContext testContextInstance;
42
43    /// <summary>
44    ///Gets or sets the test context which provides
45    ///information about and functionality for the current test run.
46    ///</summary>
47    public TestContext TestContext {
48      get {
49        return testContextInstance;
50      }
51      set {
52        testContextInstance = value;
53      }
54    }
55
56    #region Additional test attributes
57    //
58    //You can use the following additional attributes as you write your tests:
59    //
60    //Use ClassInitialize to run code before running the first test in the class
61    //[ClassInitialize()]
62    //public static void MyClassInitialize(TestContext testContext)
63    //{
64    //}
65    //
66    //Use ClassCleanup to run code after all tests in a class have run
67    //[ClassCleanup()]
68    //public static void MyClassCleanup()
69    //{
70    //}
71    //
72    //Use TestInitialize to run code before running each test
73    //[TestInitialize()]
74    //public void MyTestInitialize()
75    //{
76    //}
77    //
78    //Use TestCleanup to run code after each test has run
79    //[TestCleanup()]
80    //public void MyTestCleanup()
81    //{
82    //}
83    //
84    #endregion
85
86
87    /// <summary>
88    ///A test for GetRemotePluginList
89    ///</summary>
90    [TestMethod()]
91    public void GetRemotePluginListTest() {
92      string pluginDir = Environment.CurrentDirectory;
93      try {
94        InstallationManager target = new InstallationManager(pluginDir);
95        var pluginList = target.GetRemotePluginList();
96        Assert.IsTrue(pluginList.Count() > 0);
97      }
98      catch (Exception e) {
99        Assert.Fail("Connection to the update service failed. " + e.Message);
100      }
101    }
102
103    /// <summary>
104    ///A test for GetRemoteProductList
105    ///</summary>
106    [TestMethod()]
107    public void GetRemoteProductListTest() {
108      string pluginDir = Environment.CurrentDirectory;
109      try {
110        InstallationManager target = new InstallationManager(pluginDir);
111        var productList = target.GetRemoteProductList();
112        Assert.IsTrue(productList.Count() > 0);
113      }
114      catch (Exception e) {
115        Assert.Fail("Connection to the update service failed. " + e.Message);
116      }
117    }
118  }
119}
Note: See TracBrowser for help on using the repository browser.