Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed bug relating to IModelSerializer and the use of the {{MODEL_NAM…
…E}} key
- Loading branch information
Nick Berardi
committed
Nov 27, 2010
1 parent
4442896
commit b910608
Showing
4 changed files
with
86 additions
and
33 deletions.
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,47 @@ | ||
using System; | ||
using NUnit.Framework; | ||
using System.Dynamic; | ||
using ManagedFusion.Serialization; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace ManagedFusion.Tests | ||
{ | ||
[TestFixture] | ||
public class ModelSerializerTest | ||
{ | ||
private class TestModel : IModelSerializer | ||
{ | ||
#region IModelSerializer Members | ||
|
||
IDictionary<string, object> IModelSerializer.GetSerializedModel() | ||
{ | ||
dynamic model = new ExpandoObject(); | ||
|
||
((IDictionary<string, object>)model).Add(Serializer.ModelNameKey, "test"); | ||
model.name = "value"; | ||
|
||
return model; | ||
} | ||
|
||
#endregion | ||
} | ||
|
||
[Test] | ||
public void Simple_With_Name() | ||
{ | ||
// arrange | ||
var expected = "test"; | ||
var obj = new TestModel(); | ||
|
||
var ser = new Serializer(); | ||
var options = new SerlizerOptions { CheckForObjectName = true }; | ||
|
||
// act | ||
var result = ser.FromObject(obj, options); | ||
|
||
// assert | ||
Assert.AreEqual(expected, result.Keys.First()); | ||
} | ||
} | ||
} |
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