From 5d34cedcb326904d12771c8490510f14a44df631 Mon Sep 17 00:00:00 2001 From: James Newton-King Date: Tue, 23 Dec 2014 00:49:27 +1300 Subject: [PATCH] -Build --- Build/runbuild.cmd | 4 +--- .../Linq/AnnotationsTests.cs | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/Build/runbuild.cmd b/Build/runbuild.cmd index b8012495..43b19926 100644 --- a/Build/runbuild.cmd +++ b/Build/runbuild.cmd @@ -1,4 +1,2 @@ cls -powershell -Command "& { [Console]::WindowWidth = 150; [Console]::WindowHeight = 50; Start-Transcript runbuild.txt; Import-Module ..\Tools\PSake\psake.psm1; Invoke-psake ..\Build\build.ps1 %*; Stop-Transcript; }" - -pause \ No newline at end of file +powershell -Command "& { [Console]::WindowWidth = 150; [Console]::WindowHeight = 50; Start-Transcript runbuild.txt; Import-Module ..\Tools\PSake\psake.psm1; Invoke-psake ..\Build\build.ps1 %*; Stop-Transcript; }" \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/Linq/AnnotationsTests.cs b/Src/Newtonsoft.Json.Tests/Linq/AnnotationsTests.cs index 10a4a3da..b9caf638 100644 --- a/Src/Newtonsoft.Json.Tests/Linq/AnnotationsTests.cs +++ b/Src/Newtonsoft.Json.Tests/Linq/AnnotationsTests.cs @@ -246,5 +246,29 @@ namespace Newtonsoft.Json.Tests.Linq Uri i = o.Annotation(); Assert.AreEqual(new Uri("http://www.google.com/"), i); } + + [Test] + public void Example() + { + JObject o = JObject.Parse(@"{ + 'name': 'Bill G', + 'age': 58, + 'country': 'United States', + 'employer': 'Microsoft' + }"); + + o.AddAnnotation(new HashSet()); + o.PropertyChanged += (sender, args) => o.Annotation>().Add(args.PropertyName); + + o["age"] = 59; + o["employer"] = "Bill & Melinda Gates Foundation"; + + + HashSet changedProperties = o.Annotation>(); + // age + // employer + + Assert.AreEqual(2, changedProperties.Count); + } } } \ No newline at end of file