-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
#94 Added support for setting codec tags
- Loading branch information
Showing
37 changed files
with
2,435 additions
and
490 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,69 @@ | ||
using System; | ||
using System.Runtime.Serialization; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace Tricycle.IO.Tests | ||
{ | ||
public class JsonSerializerTests | ||
{ | ||
#region Nested Types | ||
|
||
class MockObject | ||
{ | ||
public int Value { get; set; } | ||
} | ||
|
||
#endregion | ||
|
||
#region Fields | ||
|
||
JsonSerializer _serializer; | ||
MockObject _value = new MockObject() | ||
{ | ||
Value = 2 | ||
}; | ||
string _json = | ||
"{" + Environment.NewLine + | ||
" \"value\": 2" + Environment.NewLine + | ||
"}"; | ||
|
||
#endregion | ||
|
||
#region Test Setup | ||
|
||
[TestInitialize] | ||
public void Setup() | ||
{ | ||
_serializer = new JsonSerializer(); | ||
} | ||
|
||
#endregion | ||
|
||
#region Test Methods | ||
|
||
[TestMethod] | ||
public void SerializeReturnsJsonString() | ||
{ | ||
var actual = _serializer.Serialize(_value); | ||
|
||
Assert.AreEqual(_json, actual); | ||
} | ||
|
||
[TestMethod] | ||
[ExpectedException(typeof(SerializationException))] | ||
public void DeserializeThrowsSerializationException() | ||
{ | ||
_serializer.Deserialize<MockObject>("{"); | ||
} | ||
|
||
[TestMethod] | ||
public void DeserializeReturnsObject() | ||
{ | ||
var actual = _serializer.Deserialize<MockObject>(_json); | ||
|
||
Assert.AreEqual(_value, actual); | ||
} | ||
|
||
#endregion | ||
} | ||
} |
Oops, something went wrong.