public void TestValidateValidMode() { Assembly assembly = Assembly.GetAssembly((new AdifField()).GetType()); Stream str = assembly.GetManifestResourceStream("hamqsler.AdifEnumerations.xml"); AdifEnumerations aEnums = new AdifEnumerations(str); Mode mode = new Mode("PSK", aEnums); string err = string.Empty; string modStr = string.Empty; Assert.IsTrue(mode.Validate(out err, out modStr)); Assert.IsNull(err); Assert.IsNull(modStr); }
/// <summary> /// Helper method that validates mode (cannot be string.Empty) /// </summary> /// <returns>Validation string (error string, or null if no error)</returns> private string ValidateMode() { if(Mode != string.Empty) { Mode mode = new Mode(Mode, App.AdifEnums); string err = string.Empty; string mod = string.Empty; if(!mode.Validate(out err, out mod)) { return err; } } return null; }
public void TestValidateNullMode() { Assembly assembly = Assembly.GetAssembly((new AdifField()).GetType()); Stream str = assembly.GetManifestResourceStream("hamqsler.AdifEnumerations.xml"); AdifEnumerations aEnums = new AdifEnumerations(str); Mode mode = new Mode(null, aEnums); string err = string.Empty; string modStr = string.Empty; Assert.IsFalse(mode.Validate(out err, out modStr)); Assert.AreEqual("Value is null.", err); Assert.IsNull(modStr); }