Use new WriteJson method in Sessions

This commit is contained in:
Frank A. Krueger 2018-03-03 00:21:32 -08:00
parent 0ada0c7497
commit b5dadbceb9
No known key found for this signature in database
GPG Key ID: 0471C67474FFE664
2 changed files with 7 additions and 2 deletions

View File

@ -40,8 +40,11 @@ namespace Ooui
{
w.Write ('\"');
for (var i = 0; i < s.Length; i++) {
var c = s[0];
if (c == '\r') {
var c = s[i];
if (c == '\"') {
w.Write ("\\\"");
}
else if (c == '\r') {
w.Write ("\\r");
}
else if (c == '\n') {

View File

@ -29,9 +29,11 @@ namespace Tests
var b = new Button ();
b.Text = "Hello";
b.Click += (sender, e) => { };
b.Title = "\"Quote\"";
Assert.AreEqual ("{\"m\":\"create\",\"id\":\"⦙\",\"k\":\"button\"}", NoId (b.StateMessages[0].ToJson ()));
Assert.AreEqual ("{\"m\":\"call\",\"id\":\"⦙\",\"k\":\"insertBefore\",\"v\":[\"⦙\",null]}", NoId (b.StateMessages[1].ToJson ()));
Assert.AreEqual ("{\"m\":\"listen\",\"id\":\"⦙\",\"k\":\"click\"}", NoId (b.StateMessages[2].ToJson ()));
Assert.AreEqual ("{\"m\":\"setAttr\",\"id\":\"⦙\",\"k\":\"title\",\"v\":\"\\\"Quote\\\"\"}", NoId (b.StateMessages[3].ToJson ()));
}
[TestMethod]