From 927da5b529d30d770d2d1f1af6cce8d883af6132 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduardo=20Campa=C3=B1=C3=B3?= Date: Thu, 10 Apr 2014 11:26:02 -0300 Subject: [PATCH 1/2] Removed tests file from Net2 project, it is duplicated in the tests project --- src/SimpleJson.sln | 2 +- .../EscapeToJavascriptStringTests.cs | 62 ------------------- src/SimpleJson/SimpleJson-Net20.csproj | 1 - 3 files changed, 1 insertion(+), 64 deletions(-) delete mode 100644 src/SimpleJson/EscapeToJavascriptStringTests.cs diff --git a/src/SimpleJson.sln b/src/SimpleJson.sln index f7eaf8f..fb1971b 100644 --- a/src/SimpleJson.sln +++ b/src/SimpleJson.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 -VisualStudioVersion = 12.0.20827.3 +VisualStudioVersion = 12.0.30110.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{AEDAD4B4-9F2C-4992-8CD6-A43DFDFF7172}" EndProject diff --git a/src/SimpleJson/EscapeToJavascriptStringTests.cs b/src/SimpleJson/EscapeToJavascriptStringTests.cs deleted file mode 100644 index 881882f..0000000 --- a/src/SimpleJson/EscapeToJavascriptStringTests.cs +++ /dev/null @@ -1,62 +0,0 @@ -//----------------------------------------------------------------------- -// -// Copyright (c) 2011, The Outercurve Foundation. -// -// Licensed under the MIT License (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.opensource.org/licenses/mit-license.php -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) -// https://github.com/facebook-csharp-sdk/simple-json -//----------------------------------------------------------------------- - -namespace SimpleJsonTests -{ - -#if NUNIT - using TestClass = NUnit.Framework.TestFixtureAttribute; - using TestMethod = NUnit.Framework.TestAttribute; - using TestCleanup = NUnit.Framework.TearDownAttribute; - using TestInitialize = NUnit.Framework.SetUpAttribute; - using ClassCleanup = NUnit.Framework.TestFixtureTearDownAttribute; - using ClassInitialize = NUnit.Framework.TestFixtureSetUpAttribute; - using NUnit.Framework; -#else -#if NETFX_CORE - using Microsoft.VisualStudio.TestPlatform.UnitTestFramework; -#else - using Microsoft.VisualStudio.TestTools.UnitTesting; -#endif -#endif - - using SimpleJson; - - [TestClass] - public class EscapeToJavascriptStringTests - { - [TestMethod] - public void BackSlash() - { - var serialized = SimpleJson.SerializeObject("c:\\haha.pl"); - var result = SimpleJson.EscapeToJavascriptString(serialized); - - Assert.AreEqual("\"c:\\haha.pl\"", result); - } - - [TestMethod] - public void BackSlashWithT() - { - var serialized = SimpleJson.SerializeObject("c:\\taha.pl"); - var result = SimpleJson.EscapeToJavascriptString(serialized); - - Assert.AreEqual("\"c:\\taha.pl\"", result); - } - } -} \ No newline at end of file diff --git a/src/SimpleJson/SimpleJson-Net20.csproj b/src/SimpleJson/SimpleJson-Net20.csproj index fd157b0..c44a807 100644 --- a/src/SimpleJson/SimpleJson-Net20.csproj +++ b/src/SimpleJson/SimpleJson-Net20.csproj @@ -38,7 +38,6 @@ - From bc2df6fe0c6759696b29cf72a18f845ab498c0d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduardo=20Campa=C3=B1=C3=B3?= Date: Thu, 10 Apr 2014 11:43:51 -0300 Subject: [PATCH 2/2] Fixed Con[s]tructor issue #54 --- src/SimpleJson/SimpleJson.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/SimpleJson/SimpleJson.cs b/src/SimpleJson/SimpleJson.cs index 2ab9742..b045dcf 100644 --- a/src/SimpleJson/SimpleJson.cs +++ b/src/SimpleJson/SimpleJson.cs @@ -1260,7 +1260,7 @@ class PocoJsonSerializerStrategy : IJsonSerializerStrategy public PocoJsonSerializerStrategy() { - ConstructorCache = new ReflectionUtils.ThreadSafeDictionary(ContructorDelegateFactory); + ConstructorCache = new ReflectionUtils.ThreadSafeDictionary(ConstructorDelegateFactory); GetCache = new ReflectionUtils.ThreadSafeDictionary>(GetterValueFactory); SetCache = new ReflectionUtils.ThreadSafeDictionary>>(SetterValueFactory); } @@ -1270,9 +1270,9 @@ protected virtual string MapClrMemberNameToJsonFieldName(string clrPropertyName) return clrPropertyName; } - internal virtual ReflectionUtils.ConstructorDelegate ContructorDelegateFactory(Type key) + internal virtual ReflectionUtils.ConstructorDelegate ConstructorDelegateFactory(Type key) { - return ReflectionUtils.GetContructor(key, key.IsArray ? ArrayConstructorParameterTypes : EmptyTypes); + return ReflectionUtils.GetConstructor(key, key.IsArray ? ArrayConstructorParameterTypes : EmptyTypes); } internal virtual IDictionary GetterValueFactory(Type type) @@ -1812,7 +1812,7 @@ public static MethodInfo GetSetterMethodInfo(PropertyInfo propertyInfo) #endif } - public static ConstructorDelegate GetContructor(ConstructorInfo constructorInfo) + public static ConstructorDelegate GetConstructor(ConstructorInfo constructorInfo) { #if SIMPLE_JSON_NO_LINQ_EXPRESSION return GetConstructorByReflection(constructorInfo); @@ -1821,7 +1821,7 @@ public static ConstructorDelegate GetContructor(ConstructorInfo constructorInfo) #endif } - public static ConstructorDelegate GetContructor(Type type, params Type[] argsType) + public static ConstructorDelegate GetConstructor(Type type, params Type[] argsType) { #if SIMPLE_JSON_NO_LINQ_EXPRESSION return GetConstructorByReflection(type, argsType);