File tree Expand file tree Collapse file tree
ICSharpCode.AvalonEdit.Tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ using ICSharpCode . AvalonEdit . Document ;
2+ using ICSharpCode . AvalonEdit . Highlighting ;
3+ using Newtonsoft . Json ;
4+ using NUnit . Framework ;
5+
6+
7+ namespace ICSharpCode . AvalonEdit . Tests . Highlighting
8+ {
9+ [ TestFixture ]
10+ public class DeserializationTests
11+ {
12+ TextDocument document ;
13+ DocumentHighlighter highlighter ;
14+
15+ [ SetUp ]
16+ public void SetUp ( )
17+ {
18+ document = new TextDocument ( "using System.Text;\n \t string text = SomeMethod();" ) ;
19+ highlighter = new DocumentHighlighter ( document , HighlightingManager . Instance . GetDefinition ( "C#" ) ) ;
20+ }
21+
22+ [ Test ]
23+ public void TestRoundTripColor ( )
24+ {
25+ HighlightingColor color = highlighter . GetNamedColor ( "Comment" ) ;
26+ string jsonString = JsonConvert . SerializeObject ( color ) ;
27+
28+ HighlightingColor color2 = JsonConvert . DeserializeObject < HighlightingColor > ( jsonString ) ;
29+ Assert . AreEqual ( color , color2 ) ;
30+ }
31+ }
32+ }
Original file line number Diff line number Diff line change 2222 <DefineConstants >TRACE</DefineConstants >
2323 </PropertyGroup >
2424 <ItemGroup >
25+ <PackageReference Include =" Newtonsoft.Json" Version =" 12.0.3" />
2526 <PackageReference Include =" NUnit" Version =" 3.11.0" />
2627 <PackageReference Include =" NUnit3TestAdapter" Version =" 3.13.0" />
2728 </ItemGroup >
You can’t perform that action at this time.
0 commit comments