forked from yysun/Git-Source-Control-Provider
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PackageTest.cs
77 lines (67 loc) · 2.36 KB
/
PackageTest.cs
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
69
70
71
72
73
74
75
76
77
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.VSSDK.Tools.VsIdeTesting;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.VisualStudio.Shell;
using EnvDTE;
namespace BasicSccProvider.Tests
{
/// <summary>
/// Integration test for package validation
/// </summary>
[TestClass]
public class PackageTest
{
private delegate void ThreadInvoker();
private TestContext testContextInstance;
/// <summary>
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///</summary>
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}
[TestMethod]
[HostType("VS IDE")]
public void PackageLoadTest()
{
UIThreadInvoker.Invoke((ThreadInvoker)delegate()
{
//Get the Shell Service
IVsShell shellService = VsIdeTestHostContext.ServiceProvider.GetService(typeof(SVsShell)) as IVsShell;
Assert.IsNotNull(shellService);
//Validate package load
IVsPackage package;
Guid packageGuid = new Guid("C4128D99-2000-41D1-A6C3-704E6C1A3DE2");
Assert.IsTrue(0 == shellService.LoadPackage(ref packageGuid, out package));
Assert.IsNotNull(package, "Package failed to load");
});
}
/// <summary>
/// Create project and check if the hasProjectOpened flag is set.
/// </summary>
[TestMethod()]
[HostType("VS IDE")]
public void TestHasProjectOpened()
{
UIThreadInvoker.Invoke((ThreadInvoker)delegate()
{
//Get the global service provider and the dte
IServiceProvider sp = VsIdeTestHostContext.ServiceProvider;
DTE dte = (DTE)sp.GetService(typeof(DTE));
dte.Solution.Open(@"E:\Users\Public\My Projects\GitScc\Publish\TestProjects\UTF8Test\UTF8Test.sln");
});
}
}
}