コード例 #1
0
 public void StructGetterTest()
 {
     MockValueType pt = new MockValueType(3, 2);
     PropertyInfo property = pt.GetType().GetProperty("X");
     DynamicMethodUtil.GenericGetter getter = DynamicMethodUtil.CreatePropertyGetter(property);
     Assert.AreEqual(pt.X, getter(pt), "Struct getter incorrect");
 }
コード例 #2
0
 public void AssemblyAliasTest()
 {
     Serializer s = GetSerializer();            
     MockValueType source = new MockValueType(9, 6);
     s.Context.TypeAliases.Assemblies.Add(typeof(MockValueType).Assembly);
     string result = s.Serialize(source);
     StringAssert.FullMatch(result, @"\s*\(JsonExSerializerTests\.Mocks\.MockValueType\)\s*{""X"":9, ""Y"":6}");
     MockValueType target = (MockValueType)s.Deserialize(result);
     Assert.AreEqual(source, target, "Deserialize");
 }