This repository has been archived by the owner on May 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix InvalidCastException in WebEx.JsonDecode
Mono's JsonValue implementation does do conversions for their implicit casts to string, unlike the operators for numbers. Fixes #39
- Loading branch information
Showing
4 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using NUnit.Framework; | ||
using Xamarin.Utilities; | ||
|
||
namespace Xamarin.Auth.Test | ||
{ | ||
[TestFixture] | ||
public class WebExTests | ||
{ | ||
[TestCase ("{\"string\": \"value\"}","string", "value")] | ||
[TestCase ("{\"int\": 5000}", "int", "5000")] | ||
[TestCase ("{\"bool\": true }", "bool", "true")] | ||
public void JsonDecode (string json, string arg, string value) | ||
{ | ||
var dict = WebEx.JsonDecode (json); | ||
string v; | ||
Assert.That (dict.TryGetValue (arg, out v), Is.True, "Dictionary did not contain argument '" + arg + "'"); | ||
Assert.That (v, Is.EqualTo (value)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters