Created
June 8, 2012 02:47
-
-
Save mikeobrien/2893226 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
public class Person | |
{ | |
public string Name { get; set; } | |
public string Address { get; set; } | |
} | |
public class InputModel | |
{ | |
public string GroupId { get; set; } | |
public Person Person { get; set; } | |
} | |
[Test] | |
public void should_serialize_person_into_person_property() | |
{ | |
var inputModel = JsonConvert.DeserializeObject<InputModel>( | |
"{ ""Name"":""Tom"", ""Address"":""123 Yada Lane""}"); | |
inputModel.GroupId.ShouldBeNull(); | |
inputModel.Person.ShouldNotBeNull(); | |
inputModel.Person.Name.ShouldEqual("Tom"); | |
inputModel.Person.Address.ShouldEqual("123 Yada Lane"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment