forked from ClearFoundry/ClearScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBadV8DeploymentTest.cs
More file actions
80 lines (69 loc) · 2.85 KB
/
Copy pathBadV8DeploymentTest.cs
File metadata and controls
80 lines (69 loc) · 2.85 KB
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
78
79
80
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using System;
using System.ComponentModel;
using Microsoft.ClearScript.V8;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Microsoft.ClearScript.Test
{
[TestClass]
public class BadV8DeploymentTest : ClearScriptTest
{
#region test methods
// ReSharper disable InconsistentNaming
[TestMethod, TestCategory("BadV8Deployment")]
[DeploymentItem("ClearScriptV8-64.dll", "BadV8Deployment_NoNativeLibrary")]
[DeploymentItem("ClearScriptV8-32.dll", "BadV8Deployment_NoNativeLibrary")]
public void BadV8Deployment_NoNativeLibrary()
{
V8Proxy.RunWithDeploymentDir("BadV8Deployment_NoNativeLibrary", () =>
{
var testException = new Win32Exception(126 /*ERROR_MOD_NOT_FOUND*/);
TypeLoadException caughtException = null;
try
{
using (new V8ScriptEngine())
{
}
}
catch (TypeLoadException exception)
{
caughtException = exception;
}
Assert.IsNotNull(caughtException);
// ReSharper disable once PossibleNullReferenceException
Assert.IsTrue(caughtException.Message.Contains(testException.Message));
});
}
[TestMethod, TestCategory("BadV8Deployment")]
[DeploymentItem("v8-x64.dll", "BadV8Deployment_NoManagedAssembly")]
[DeploymentItem("v8-ia32.dll", "BadV8Deployment_NoManagedAssembly")]
[DeploymentItem("v8-base-x64.dll", "BadV8Deployment_NoManagedAssembly")]
[DeploymentItem("v8-base-ia32.dll", "BadV8Deployment_NoManagedAssembly")]
[DeploymentItem("v8-zlib-x64.dll", "BadV8Deployment_NoManagedAssembly")]
[DeploymentItem("v8-zlib-ia32.dll", "BadV8Deployment_NoManagedAssembly")]
public void BadV8Deployment_NoManagedAssembly()
{
V8Proxy.RunWithDeploymentDir("BadV8Deployment_NoManagedAssembly", () =>
{
var testException = new Win32Exception(2 /*ERROR_FILE_NOT_FOUND*/);
TypeLoadException caughtException = null;
try
{
using (new V8ScriptEngine())
{
}
}
catch (TypeLoadException exception)
{
caughtException = exception;
}
Assert.IsNotNull(caughtException);
// ReSharper disable once PossibleNullReferenceException
Assert.IsTrue(caughtException.Message.Contains(testException.Message));
});
}
// ReSharper restore InconsistentNaming
#endregion
}
}