Skip to content

Commit f5dcef3

Browse files
committed
added support for .net core / net standard 1.3 (only safe variant)
1 parent 0e80222 commit f5dcef3

33 files changed

+11471
-61
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ obj
55
packages
66
.tools
77
.idea
8-
*.iml
8+
*.iml
9+
private.snk

DeepCloner.Core.sln

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 2013
4+
VisualStudioVersion = 12.0.0.0
5+
MinimumVisualStudioVersion = 10.0.0.1
6+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "DeepCloner.Core", "DeepCloner\DeepCloner.xproj", "{CB0E426A-9468-48FA-9679-A782801F1D15}"
7+
EndProject
8+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "DeepCloner.Tests", "DeepCloner.Tests\DeepCloner.Tests.xproj", "{4939517A-4872-4CD3-9618-B3C69B68B688}"
9+
EndProject
10+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{61E9C5A9-C238-44DB-B8FC-C9440B1E6E16}"
11+
ProjectSection(SolutionItems) = preProject
12+
README.md = README.md
13+
EndProjectSection
14+
EndProject
15+
Global
16+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
17+
Debug|Any CPU = Debug|Any CPU
18+
Release|Any CPU = Release|Any CPU
19+
EndGlobalSection
20+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
21+
{CB0E426A-9468-48FA-9679-A782801F1D15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
22+
{CB0E426A-9468-48FA-9679-A782801F1D15}.Debug|Any CPU.Build.0 = Debug|Any CPU
23+
{CB0E426A-9468-48FA-9679-A782801F1D15}.Release|Any CPU.ActiveCfg = Release|Any CPU
24+
{CB0E426A-9468-48FA-9679-A782801F1D15}.Release|Any CPU.Build.0 = Release|Any CPU
25+
{4939517A-4872-4CD3-9618-B3C69B68B688}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
26+
{4939517A-4872-4CD3-9618-B3C69B68B688}.Debug|Any CPU.Build.0 = Debug|Any CPU
27+
{4939517A-4872-4CD3-9618-B3C69B68B688}.Release|Any CPU.ActiveCfg = Release|Any CPU
28+
{4939517A-4872-4CD3-9618-B3C69B68B688}.Release|Any CPU.Build.0 = Release|Any CPU
29+
EndGlobalSection
30+
GlobalSection(SolutionProperties) = preSolution
31+
HideSolutionNode = FALSE
32+
EndGlobalSection
33+
EndGlobal

DeepCloner.Tests/ArraysSpec.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66

77
namespace Force.DeepCloner.Tests
88
{
9+
#if !NETCORE
910
[TestFixture(false)]
11+
#endif
1012
[TestFixture(true)]
1113
public class ArraysSpec : BaseTest
1214
{

DeepCloner.Tests/CloneExtensionsSpec.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using CloneExtensions;
1+
#if !NETCORE
2+
using CloneExtensions;
23

34
using NUnit.Framework;
45

@@ -141,3 +142,4 @@ public void AnonymousType_Should_be_Cloned()
141142
}
142143
}
143144
}
145+
#endif

DeepCloner.Tests/ConstructorsSpec.cs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
namespace Force.DeepCloner.Tests
66
{
7+
#if !NETCORE
78
[TestFixture(false)]
9+
#endif
810
[TestFixture(true)]
911
public class ConstructorsSpec : BaseTest
1012
{
@@ -64,6 +66,7 @@ public override string ToString()
6466
}
6567
}
6668

69+
#if !NETCORE
6770
public class ClonableClass : ICloneable
6871
{
6972
public object X { get; set; }
@@ -74,6 +77,15 @@ public object Clone()
7477
}
7578
}
7679

80+
[Test]
81+
public void Cloner_Should_Not_Call_Any_Method_Of_Clonable_Class()
82+
{
83+
// just for check, ensure no hidden behaviour in MemberwiseClone
84+
Assert.DoesNotThrow(() => new ClonableClass().DeepClone());
85+
Assert.DoesNotThrow(() => new { X = new ClonableClass() }.DeepClone());
86+
}
87+
#endif
88+
7789
[Test]
7890
public void Object_With_Private_Constructor_Should_Be_Cloned()
7991
{
@@ -103,6 +115,7 @@ public void Anonymous_Object_Should_Be_Cloned()
103115
Assert.That(cloned.B, Is.EqualTo("x"));
104116
}
105117

118+
#if !NETCORE
106119
private class C3 : ContextBoundObject
107120
{
108121
}
@@ -128,6 +141,7 @@ public void MarshalByRef_Object_Should_Be_Cloned()
128141
var cloned = c.DeepClone();
129142
Assert.That(cloned, Is.Not.Null);
130143
}
144+
#endif
131145

132146
[Test]
133147
public void Cloner_Should_Not_Call_Any_Method_Of_Class_Be_Cloned()
@@ -136,13 +150,5 @@ public void Cloner_Should_Not_Call_Any_Method_Of_Class_Be_Cloned()
136150
var exClass = new ExClass("x");
137151
Assert.DoesNotThrow(() => new[] { exClass, exClass }.DeepClone());
138152
}
139-
140-
[Test]
141-
public void Cloner_Should_Not_Call_Any_Method_Of_Clonable_Class()
142-
{
143-
// just for check, ensure no hidden behaviour in MemberwiseClone
144-
Assert.DoesNotThrow(() => new ClonableClass().DeepClone());
145-
Assert.DoesNotThrow(() => new { X = new ClonableClass() }.DeepClone());
146-
}
147153
}
148154
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
5+
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
6+
</PropertyGroup>
7+
8+
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
9+
<PropertyGroup Label="Globals">
10+
<ProjectGuid>{4939517A-4872-4CD3-9618-B3C69B68B688}</ProjectGuid>
11+
<ProjectTypeGuids>{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}</ProjectTypeGuids>
12+
<RootNamespace>DeepCloner.Tests1</RootNamespace>
13+
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
14+
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
15+
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
16+
</PropertyGroup>
17+
18+
<PropertyGroup>
19+
<SchemaVersion>2.0</SchemaVersion>
20+
</PropertyGroup>
21+
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
22+
</Project>

DeepCloner.Tests/GenericsSpec.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
namespace Force.DeepCloner.Tests
66
{
7+
#if !NETCORE
78
[TestFixture(false)]
9+
#endif
810
[TestFixture(true)]
911
public class GenericsSpec : BaseTest
1012
{

DeepCloner.Tests/Imported/FastDeepCloner.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// copied from https://raw.githubusercontent.com/Alenah091/FastDeepCloner/master/FastDeepCloner.cs because I need .NET 4.0 for tests
1+
#if !NETCORE
2+
// copied from https://raw.githubusercontent.com/Alenah091/FastDeepCloner/master/FastDeepCloner.cs because I need .NET 4.0 for tests
23
using System;
34
using System.Collections;
45
using System.Collections.Generic;
@@ -288,4 +289,5 @@ public enum FieldType
288289
FieldInfo,
289290
PropertyInfo
290291
}
291-
}
292+
}
293+
#endif

DeepCloner.Tests/InheritanceSpec.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55

66
namespace Force.DeepCloner.Tests
77
{
8+
#if !NETCORE
89
[TestFixture(false)]
10+
#endif
911
[TestFixture(true)]
1012
public class InheritanceSpec : BaseTest
1113
{

DeepCloner.Tests/PerformanceSpec.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System;
1+
#if !NETCORE
2+
using System;
23
using System.Diagnostics;
34
using System.IO;
45
using System.Runtime.InteropServices;
@@ -250,3 +251,4 @@ public void Test_Shallow_Variants()
250251
}
251252
}
252253
}
254+
#endif

0 commit comments

Comments
 (0)