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"); }
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"); }