public static string GetFieldOrDefault(FieldMap fields, int tag, string defaultValue) { if (!fields.IsSetField(tag)) return defaultValue; try { return fields.GetField(tag); } catch (FieldNotFoundException) { return defaultValue; } }
public void CharFieldTest() { CharField field = new CharField(100, 'd'); fieldmap.SetField(field); CharField refield = new CharField(100); fieldmap.GetField(refield); Assert.That('d', Is.EqualTo(refield.Obj)); field.Obj = 'e'; fieldmap.SetField(field); CharField r = fieldmap.GetField(refield); Assert.That('e', Is.EqualTo(refield.Obj)); Assert.AreSame(refield, r); }