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
60 lines (51 loc) · 1.73 KB
/
BadV8DeploymentTest.cs
File metadata and controls
60 lines (51 loc) · 1.73 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
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using System;
using System.ComponentModel;
using System.Reflection;
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")]
public void BadV8Deployment_NoNativeLibrary()
{
GC.Collect();
V8Proxy.RunWithDeploymentDir("BadV8Deployment_NoNativeLibrary", () =>
{
var moduleNotFoundException = new Win32Exception(126 /*ERROR_MOD_NOT_FOUND*/);
TypeLoadException caughtException = null;
try
{
using (new V8ScriptEngine())
{
}
}
catch (TypeLoadException exception)
{
caughtException = exception;
}
catch (TargetInvocationException exception)
{
if (exception.InnerException is TypeLoadException typeLoadException)
{
caughtException = typeLoadException;
}
else
{
throw;
}
}
Assert.IsNotNull(caughtException);
Assert.IsTrue(caughtException.Message.Contains(moduleNotFoundException.Message));
});
}
// ReSharper restore InconsistentNaming
#endregion
}
}