Add NewtonSoft.Json and red round-tip test
This commit is contained in:
Родитель
9ecaeb031c
Коммит
f57441b3d0
|
@ -0,0 +1,32 @@
|
|||
using ICSharpCode.AvalonEdit.Document;
|
||||
using ICSharpCode.AvalonEdit.Highlighting;
|
||||
using Newtonsoft.Json;
|
||||
using NUnit.Framework;
|
||||
|
||||
|
||||
namespace ICSharpCode.AvalonEdit.Tests.Highlighting
|
||||
{
|
||||
[TestFixture]
|
||||
public class DeserializationTests
|
||||
{
|
||||
TextDocument document;
|
||||
DocumentHighlighter highlighter;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
document = new TextDocument("using System.Text;\n\tstring text = SomeMethod();");
|
||||
highlighter = new DocumentHighlighter(document, HighlightingManager.Instance.GetDefinition("C#"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRoundTripColor()
|
||||
{
|
||||
HighlightingColor color = highlighter.GetNamedColor("Comment");
|
||||
string jsonString = JsonConvert.SerializeObject(color);
|
||||
|
||||
HighlightingColor color2 = JsonConvert.DeserializeObject<HighlightingColor>(jsonString);
|
||||
Assert.AreEqual(color, color2);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -22,6 +22,7 @@
|
|||
<DefineConstants>TRACE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="NUnit" Version="3.11.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.13.0" />
|
||||
</ItemGroup>
|
||||
|
|
Загрузка…
Ссылка в новой задаче