Skip to content

Commit c7b36ee

Browse files
committed
1. Removed dependency on System.Configuration.dll (no longer supported configuration by using the Web.config and App.config files);
2. Unit tests rewritten on xUnit.net.
1 parent e94f2cb commit c7b36ee

File tree

112 files changed

+1601
-1732
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+1601
-1732
lines changed

src/JavaScriptEngineSwitcher.ChakraCore/AssemblyResolver.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
namespace JavaScriptEngineSwitcher.ChakraCore
2-
{
3-
using System;
4-
using System.IO;
5-
using System.Runtime.InteropServices;
6-
using System.Text.RegularExpressions;
1+
using System;
2+
using System.IO;
3+
using System.Runtime.InteropServices;
4+
using System.Text.RegularExpressions;
75

8-
using Resources;
6+
using JavaScriptEngineSwitcher.ChakraCore.Resources;
97

8+
namespace JavaScriptEngineSwitcher.ChakraCore
9+
{
1010
/// <summary>
1111
/// Assembly resolver
1212
/// </summary>

src/JavaScriptEngineSwitcher.ChakraCore/ChakraCoreJsEngine.cs

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
1-
namespace JavaScriptEngineSwitcher.ChakraCore
2-
{
3-
using System;
4-
using System.Collections.Generic;
5-
using System.Globalization;
6-
using System.Linq;
7-
using System.Reflection;
8-
using System.Runtime.InteropServices;
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Globalization;
4+
using System.Linq;
5+
using System.Reflection;
6+
using System.Runtime.InteropServices;
97

10-
using OriginalJsException = JsRt.JsException;
8+
using OriginalJsException = JavaScriptEngineSwitcher.ChakraCore.JsRt.JsException;
119

12-
using Core;
13-
using Core.Utilities;
14-
using CoreStrings = Core.Resources.Strings;
10+
using JavaScriptEngineSwitcher.Core;
11+
using JavaScriptEngineSwitcher.Core.Utilities;
12+
using CoreStrings = JavaScriptEngineSwitcher.Core.Resources.Strings;
1513

16-
using Helpers;
17-
using JsRt;
18-
using Resources;
14+
using JavaScriptEngineSwitcher.ChakraCore.Helpers;
15+
using JavaScriptEngineSwitcher.ChakraCore.JsRt;
16+
using JavaScriptEngineSwitcher.ChakraCore.Resources;
1917

18+
namespace JavaScriptEngineSwitcher.ChakraCore
19+
{
2020
/// <summary>
21-
/// Adapter for ChakraCore JavaScript engine
21+
/// Adapter for the ChakraCore JS engine
2222
/// </summary>
2323
public sealed class ChakraCoreJsEngine : JsEngineBase
2424
{
2525
/// <summary>
26-
/// Name of JavaScript engine
26+
/// Name of JS engine
2727
/// </summary>
28-
private const string ENGINE_NAME = "ChakraCore JavaScript engine";
28+
private const string ENGINE_NAME = "ChakraCore JS engine";
2929

3030
/// <summary>
31-
/// Version of original JavaScript engine
31+
/// Version of original JS engine
3232
/// </summary>
3333
private const string ENGINE_VERSION = "1.2";
3434

3535
/// <summary>
36-
/// Instance of JavaScript runtime
36+
/// Instance of JS runtime
3737
/// </summary>
3838
private JsRuntime _jsRuntime;
3939

4040
/// <summary>
41-
/// Instance of JavaScript context
41+
/// Instance of JS context
4242
/// </summary>
4343
private readonly JsContext _jsContext;
4444

@@ -63,15 +63,15 @@ public sealed class ChakraCoreJsEngine : JsEngineBase
6363
private readonly ISet<JsNativeFunction> _nativeFunctions;
6464

6565
/// <summary>
66-
/// Gets a name of JavaScript engine
66+
/// Gets a name of JS engine
6767
/// </summary>
6868
public override string Name
6969
{
7070
get { return ENGINE_NAME; }
7171
}
7272

7373
/// <summary>
74-
/// Gets a version of original JavaScript engine
74+
/// Gets a version of original JS engine
7575
/// </summary>
7676
public override string Version
7777
{
@@ -88,7 +88,7 @@ static ChakraCoreJsEngine()
8888
}
8989

9090
/// <summary>
91-
/// Constructs a instance of adapter for ChakraCore JavaScript engine
91+
/// Constructs a instance of adapter for the ChakraCore JS engine
9292
/// </summary>
9393
public ChakraCoreJsEngine()
9494
{
@@ -110,7 +110,7 @@ public ChakraCoreJsEngine()
110110
}
111111

112112
/// <summary>
113-
/// Destructs instance of adapter for ChakraCore JavaScript engine
113+
/// Destructs instance of adapter for the ChakraCore JS engine
114114
/// </summary>
115115
~ChakraCoreJsEngine()
116116
{
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using JavaScriptEngineSwitcher.Core;
2+
3+
namespace JavaScriptEngineSwitcher.ChakraCore
4+
{
5+
/// <summary>
6+
/// ChakraCore JS engine factory
7+
/// </summary>
8+
public sealed class ChakraCoreJsEngineFactory : IJsEngineFactory
9+
{
10+
/// <summary>
11+
/// Gets a name of JS engine
12+
/// </summary>
13+
public string EngineName
14+
{
15+
get { return "ChakraCoreJsEngine"; }
16+
}
17+
18+
19+
/// <summary>
20+
/// Creates a instance of the ChakraCore JS engine
21+
/// </summary>
22+
/// <returns>Instance of the ChakraCore JS engine</returns>
23+
public IJsEngine CreateEngine()
24+
{
25+
return new ChakraCoreJsEngine();
26+
}
27+
}
28+
}

src/JavaScriptEngineSwitcher.ChakraCore/Helpers/NumericHelpers.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
namespace JavaScriptEngineSwitcher.ChakraCore.Helpers
2-
{
3-
using System;
1+
using System;
42

3+
namespace JavaScriptEngineSwitcher.ChakraCore.Helpers
4+
{
55
/// <summary>
66
/// Numeric helpers
77
/// </summary>

src/JavaScriptEngineSwitcher.ChakraCore/Helpers/ReflectionHelpers.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
namespace JavaScriptEngineSwitcher.ChakraCore.Helpers
2-
{
3-
using System;
4-
using System.Linq;
5-
using System.Reflection;
1+
using System;
2+
using System.Linq;
3+
using System.Reflection;
64

7-
using Core.Utilities;
5+
using JavaScriptEngineSwitcher.Core.Utilities;
86

7+
namespace JavaScriptEngineSwitcher.ChakraCore.Helpers
8+
{
99
/// <summary>
1010
/// Reflection helpers
1111
/// </summary>

src/JavaScriptEngineSwitcher.ChakraCore/JavaScriptEngineSwitcher.ChakraCore.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@
4343
<ItemGroup>
4444
<Compile Include="AssemblyResolver.cs" />
4545
<Compile Include="ChakraCoreJsEngine.cs" />
46+
<Compile Include="ChakraCoreJsEngineFactory.cs" />
4647
<Compile Include="Helpers\NumericHelpers.cs" />
4748
<Compile Include="Helpers\ReflectionHelpers.cs" />
49+
<Compile Include="JsEngineFactoryCollectionExtensions.cs" />
4850
<Compile Include="JsRt\JsBackgroundWorkItemCallback.cs" />
4951
<Compile Include="JsRt\JsBeforeCollectCallback.cs" />
5052
<Compile Include="JsRt\JsContext.cs" />
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using JavaScriptEngineSwitcher.Core;
2+
3+
namespace JavaScriptEngineSwitcher.ChakraCore
4+
{
5+
/// <summary>
6+
/// JS engine factory collection extensions
7+
/// </summary>
8+
public static class JsEngineFactoryCollectionExtensions
9+
{
10+
/// <summary>
11+
/// Adds a instance of <see cref="ChakraCoreJsEngineFactory"/> to
12+
/// the specified <see cref="JsEngineFactoryCollection" />
13+
/// </summary>
14+
/// <param name="source">Instance of <see cref="JsEngineFactoryCollection" /></param>
15+
/// <returns>Instance of <see cref="JsEngineFactoryCollection" /></returns>
16+
public static JsEngineFactoryCollection AddChakraCore(this JsEngineFactoryCollection source)
17+
{
18+
source.Add(new ChakraCoreJsEngineFactory());
19+
20+
return source;
21+
}
22+
}
23+
}

src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsBackgroundWorkItemCallback.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
namespace JavaScriptEngineSwitcher.ChakraCore.JsRt
2-
{
3-
using System;
1+
using System;
42

3+
namespace JavaScriptEngineSwitcher.ChakraCore.JsRt
4+
{
55
/// <summary>
66
/// The background work item callback
77
/// </summary>

src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsBeforeCollectCallback.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
namespace JavaScriptEngineSwitcher.ChakraCore.JsRt
2-
{
3-
using System;
1+
using System;
42

3+
namespace JavaScriptEngineSwitcher.ChakraCore.JsRt
4+
{
55
/// <summary>
66
/// The callback called before collection
77
/// </summary>

src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsContext.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
namespace JavaScriptEngineSwitcher.ChakraCore.JsRt
2-
{
3-
using System;
1+
using System;
42

3+
namespace JavaScriptEngineSwitcher.ChakraCore.JsRt
4+
{
55
/// <summary>
66
/// The script context
77
/// </summary>

0 commit comments

Comments
 (0)