private static void YamlNonGenericNullTest(IYamlSerializer serializer) { var type = typeof(TestModel); var yaml = serializer.ToYaml(type, null); var deserializeModel = serializer.FromYaml(type, yaml); Assert.Null(deserializeModel); }
private static void YamlGenericNullTest(IYamlSerializer serializer) { TestModel?model = null; var yaml = serializer.ToYaml(model); var deserializeModel = serializer.FromYaml <TestModel>(yaml); Assert.Null(deserializeModel); }
private static void YamlGenericTest(IYamlSerializer serializer) { var model = TestModelFactory.Create(); var yaml = serializer.ToYaml(model); var deserializeModel = serializer.FromYaml<TestModel>(yaml)!; Assert.Equal( Tuple.Create(model.Id, model.Age, model.CreateTime, model.Name, model.Gender), Tuple.Create(deserializeModel.Id, deserializeModel.Age, deserializeModel.CreateTime, deserializeModel.Name, deserializeModel.Gender)); }