public void MigrationTest() { var jtoken = JToken.Parse("{\"JsonVersion\":\"1\",\"StringValue\":\"String1\",\"IntegerValue\":1}"); jtoken = JsonMigrator.Migrate <DummyClass>(jtoken); var dummy = jtoken.ToObject <DummyClass>(); Assert.AreEqual(dummy.StringValue3, "String1"); Assert.AreEqual(dummy.IntegerValue3, 1); Assert.AreEqual(dummy.JsonVersion, "3"); }
public void WrongParameterTypeTest() { var jtoken = JToken.Parse("{\"JsonVersion\":\"1\",\"StringValue\":\"String1\",\"IntegerValue\":1}"); JsonMigrator.Migrate <WrongParameterTypeDummy>(jtoken); }
public void PublicTest() { var jtoken = JToken.Parse("{\"JsonVersion\":\"1\",\"StringValue\":\"String1\",\"IntegerValue\":1}"); JsonMigrator.Migrate <PublicDummy>(jtoken); }
public void MissingVersionTest() { var jtoken = JToken.Parse("{\"StringValue\":\"String1\",\"IntegerValue\":1}"); JsonMigrator.Migrate <DummyClass>(jtoken); }