Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/Newtonsoft.Json.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamesNK <james@newtonking.com>2011-04-22 07:11:42 +0400
committerJamesNK <james@newtonking.com>2011-04-22 07:11:42 +0400
commit21a2a7e4f793e395987d60b3ae0296de885c5774 (patch)
treeeaa4a7a7fcb584b4ee4e22dc20a309b5476898f7 /Src/Newtonsoft.Json.Tests
parent2c190ec438187affa34b161bfecf65bcf626cacb (diff)
-Demo
-Changed build script to support NuGet profiles
Diffstat (limited to 'Src/Newtonsoft.Json.Tests')
-rw-r--r--Src/Newtonsoft.Json.Tests/Linq/DynamicTests.cs35
-rw-r--r--Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs4
2 files changed, 37 insertions, 2 deletions
diff --git a/Src/Newtonsoft.Json.Tests/Linq/DynamicTests.cs b/Src/Newtonsoft.Json.Tests/Linq/DynamicTests.cs
index 23c360b..12c6e23 100644
--- a/Src/Newtonsoft.Json.Tests/Linq/DynamicTests.cs
+++ b/Src/Newtonsoft.Json.Tests/Linq/DynamicTests.cs
@@ -601,6 +601,41 @@ namespace Newtonsoft.Json.Tests.Linq
// Admin
}
+ [Test]
+ public void ImprovedDynamicLinqExample()
+ {
+ dynamic product = new JObject();
+ product.ProductName = "Elbow Grease";
+ product.Enabled = true;
+ product.Price = 4.90m;
+ product.StockCount = 9000;
+ product.StockValue = 44100;
+
+ // All Elbow Grease must go sale!
+ // 50% off price
+
+ product.Price = product.Price / 2;
+ product.StockValue = product.StockCount * product.Price;
+ product.ProductName = product.ProductName + " (SALE)";
+
+ string json = product.ToString();
+ // {
+ // "ProductName": "Elbow Grease (SALE)",
+ // "Enabled": true,
+ // "Price": 2.45,
+ // "StockCount": 9000,
+ // "StockValue": 22050.0
+ // }
+
+ Assert.AreEqual(@"{
+ ""ProductName"": ""Elbow Grease (SALE)"",
+ ""Enabled"": true,
+ ""Price"": 2.45,
+ ""StockCount"": 9000,
+ ""StockValue"": 22050.0
+}", json);
+ }
+
public class DynamicDictionary : DynamicObject
{
private readonly IDictionary<string, object> _values = new Dictionary<string, object>();
diff --git a/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs b/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs
index 95955c6..c094b45 100644
--- a/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs
+++ b/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs
@@ -39,7 +39,7 @@ using System.Runtime.InteropServices;
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("4.2.0.0")]
+[assembly: AssemblyVersion("4.0.2.0")]
#if !PocketPC
-[assembly: AssemblyFileVersion("4.2.13610.1823")]
+[assembly: AssemblyFileVersion("4.0.2.13622")]
#endif