Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 222c83e

Browse files
committed
Move project.json to /tests folder
1 parent a22b0d0 commit 222c83e

9 files changed

+125
-18
lines changed

.vscode/launch.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": ".NET Core Launch (console)",
6+
"type": "coreclr",
7+
"request": "launch",
8+
"preLaunchTask": "build",
9+
"program": "${workspaceRoot}/tests/ServiceStack.Redis.Tests/bin/Debug/netcoreapp1.0/ServiceStack.Redis.Tests.dll",
10+
"args": [],
11+
"cwd": "${workspaceRoot}",
12+
"stopAtEntry": false,
13+
"externalConsole": false
14+
}
15+
]
16+
}

.vscode/tasks.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "0.1.0",
5+
"command": "dotnet",
6+
"isShellCommand": true,
7+
"args": [],
8+
"tasks": [
9+
{
10+
"taskName": "build",
11+
"args": [ "tests/ServiceStack.Redis.Tests"],
12+
"isBuildCommand": true,
13+
"showOutput": "silent",
14+
"problemMatcher": "$msCompile"
15+
}
16+
]
17+
}

global.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"projects": [
3+
"src",
4+
"tests"
5+
]
6+
}

tests/ServiceStack.Redis.Tests/LicenseUsageTests.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public class RegisteredLicenseUsageTests : LicenseUsageTests
7878
public void Allows_access_of_21_types()
7979
{
8080
#if NETCORE
81-
Environment.GetEnvironmentVariable("SERVICESTACK_LICENSE");
81+
Environment.GetEnvironmentVariable("SERVICESTACK_LICENSE");
8282
#else
8383
Licensing.RegisterLicense(new AppSettings().GetString("servicestack:license"));
8484
#endif
@@ -96,7 +96,7 @@ public void Allows_access_of_21_types()
9696
public void Allows_access_of_6100_operations()
9797
{
9898
#if NETCORE
99-
Environment.GetEnvironmentVariable("SERVICESTACK_LICENSE");
99+
Environment.GetEnvironmentVariable("SERVICESTACK_LICENSE");
100100
#else
101101
Licensing.RegisterLicense(new AppSettings().GetString("servicestack:license"));
102102
#endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using NUnitLite;
2+
using NUnit.Common;
3+
using System.Reflection;
4+
using ServiceStack;
5+
using ServiceStack.Text;
6+
using System;
7+
using System.Globalization;
8+
using System.Threading;
9+
10+
namespace NUnitLite.Tests
11+
{
12+
public class NetCoreTestsRunner
13+
{
14+
/// <summary>
15+
/// The main program executes the tests. Output may be routed to
16+
/// various locations, depending on the arguments passed.
17+
/// </summary>
18+
/// <remarks>Run with --help for a full list of arguments supported</remarks>
19+
/// <param name="args"></param>
20+
public static int Main(string[] args)
21+
{
22+
var licenseKey = Environment.GetEnvironmentVariable("SERVICESTACK_LICENSE");
23+
if (licenseKey.IsNullOrEmpty())
24+
throw new ArgumentNullException("SERVICESTACK_LICENSE", "Add Environment variable for SERVICESTACK_LICENSE");
25+
26+
Licensing.RegisterLicense(licenseKey);
27+
//"ActivatedLicenseFeatures: ".Print(LicenseUtils.ActivatedLicenseFeatures());
28+
29+
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US");
30+
JsConfig.InitStatics();
31+
//JsonServiceClient client = new JsonServiceClient();
32+
var writer = new ExtendedTextWrapper(Console.Out);
33+
return new AutoRun(((IReflectableType)typeof(NetCoreTestsRunner)).GetTypeInfo().Assembly).Execute(args, writer, Console.In);
34+
}
35+
}
36+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"frameworks": {
3+
"net45": {}
4+
},
5+
"runtimes": {
6+
"win": {},
7+
"win-x86": {}
8+
}
9+
}

tests/ServiceStack.Redis.Tests/SslTests.cs

+1-14
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,7 @@ public void Can_connect_to_NetworkStream()
9595

9696
if (!socket.Connected)
9797
{
98-
#if NETCORE
99-
socket.Dispose();
100-
#else
10198
socket.Close();
102-
#endif
10399
throw new Exception("Could not connect");
104100
}
105101

@@ -121,11 +117,7 @@ public void Can_connect_to_Buffered_SslStream()
121117

122118
if (!socket.Connected)
123119
{
124-
#if NETCORE
125-
socket.Dispose();
126-
#else
127120
socket.Close();
128-
#endif
129121
throw new Exception("Could not connect");
130122
}
131123

@@ -143,13 +135,8 @@ public void Can_connect_to_Buffered_SslStream()
143135
}
144136
else
145137
{
146-
#if NETCORE
147-
var ctor = typeof(SslStream).GetTypeInfo().GetConstructors()
138+
var ctor = typeof(SslStream).GetAllConstructors()
148139
.First(x => x.GetParameters().Length == 5);
149-
#else
150-
var ctor = typeof(SslStream).GetConstructors()
151-
.First(x => x.GetParameters().Length == 5);
152-
#endif
153140

154141
var policyType = AssemblyUtils.FindType("System.Net.Security.EncryptionPolicy");
155142
var policyValue = Enum.Parse(policyType, "RequireEncryption");

tests/ServiceStack.Redis.Tests/UserSessionRedisClientTests.cs

-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ public class UserSessionTests
1414
{
1515
static UserSessionTests()
1616
{
17-
#if !NETCORE
1817
LogManager.LogFactory = new ConsoleLogFactory();
19-
#endif
2018
}
2119

2220
//MasterUser master;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"configurations": {
3+
"Debug": {
4+
"buildOptions": {
5+
"define": ["NETCORE_SUPPORT", "NETCORE", "DEBUG", "TRACE"]
6+
}
7+
},
8+
"Release": {
9+
"buildOptions": {
10+
"define": ["NETCORE_SUPPORT", "NETCORE", "TRACE"],
11+
"optimize": true
12+
}
13+
}
14+
},
15+
"buildOptions": {
16+
"debugType": "portable",
17+
"emitEntryPoint": true
18+
},
19+
"dependencies": {
20+
"Microsoft.NETCore.App": {
21+
"type": "platform",
22+
"version": "1.0.0"
23+
},
24+
"NUnitLite" : "3.2.1",
25+
"ServiceStack.Redis" : "1.0.*",
26+
"ServiceStack.Interfaces" : "1.0.*",
27+
"ServiceStack.Text" : "1.0.*",
28+
"ServiceStack.Common" : "1.0.*"
29+
},
30+
"frameworks": {
31+
"netcoreapp1.0": {
32+
"imports": "dnxcore50",
33+
"dependencies" : {
34+
"System.Runtime.Serialization.Primitives": "4.1.1"
35+
}
36+
}
37+
}
38+
}

0 commit comments

Comments
 (0)