public void TestRecordConverPolicy() { var policy = new GetValueConverPolicy(); var record = new Record() { [nameof(Pa.A)] = "aa", [nameof(Pa.B)] = 1, [nameof(Pa.C)] = (decimal)22 }; var b = policy.ConverTo <IRecord, Pa>(record); Assert.AreEqual(b.A, "aa"); Assert.AreEqual(b.B, 1); }
public void TestDefaultConverPolicy() { var policy = new DefaultConverPolicy(); var a = new Pa() { A = "aa", B = 1, }; var b = policy.ConverTo <Pa, Pb>(a); Assert.AreEqual(b.A, "aa"); Assert.AreEqual(b.B, 1); var policy1 = new GetValueConverPolicy(); var record = new Record() { [nameof(Pa.A)] = "aa", [nameof(Pa.B)] = 1, [nameof(Pa.C)] = (decimal)22 }; var bb = policy1.ConverTo <IRecord, Pa>(record); }