Beispiel #1
0
 /// <summary>
 /// Helper method that validates manager callsign
 /// </summary>
 /// <returns>validation string (error string or null if no error)</returns>
 private string ValidateManager()
 {
     if(Manager == string.Empty)
     {
         return null;
     }
     string err = string.Empty;
     string mod = string.Empty;
     Call mgrCall = new Call(Manager);
     if(!mgrCall.Validate(out err, out mod))
     {
         return "Not a valid callsign";
     }
     if(mgrCall.Value != mgrCall.GetCall())
     {
         return "Manager callsign must not contain modifiers (e.g. VA3HJ, not XE1/VA3HJ)";
     }
     return null;
 }
Beispiel #2
0
 /// <summary>
 /// Helper method that validates a callsign
 /// </summary>
 /// <returns>validation string (error string or null if no error)</returns>
 private string ValidateCallsign()
 {
     string err = string.Empty;
     string mod = string.Empty;
     Call call = new Call(Callsign);
     if(!call.Validate(out err, out mod))
     {
         return "Not a valid callsign";
     }
     return null;
 }
Beispiel #3
0
 public void TestValidateZW1CCOM54()
 {
     Call call = new Call("ZW1CCOM54");
     string error = string.Empty;
     string modStr = string.Empty;
     Assert.IsTrue(call.Validate(out error, out modStr));
     Assert.IsNull(error);
     Assert.IsNull(modStr);
 }
Beispiel #4
0
 public void TestValidateVAHJ()
 {
     Call call = new Call("VAHJ");
     string error = string.Empty;
     string modStr = string.Empty;
     Assert.IsFalse(call.Validate(out error, out modStr));
     Assert.AreEqual("\tCallsign 'VAHJ' is invalid.", error);
     Assert.IsNull(modStr);
 }
Beispiel #5
0
 public void TestValidatePrefix()
 {
     Call call = new Call("GB2/VA3HJ");
     string error = string.Empty;
     string modStr = string.Empty;
     Assert.IsTrue(call.Validate(out error, out modStr));
     Assert.IsNull(error);
     Assert.IsNull(modStr);
 }
Beispiel #6
0
 /// <summary>
 /// Validator from the IDataErrorInfo interface
 /// </summary>
 public string this[string propertyName]
 {
     get
     {
         if(propertyName == "Manager")
         {
             if(Manager == string.Empty)
             {
                 return null;
             }
             Call mgr = new Call(Manager);
             string err = string.Empty;
             string mod = string.Empty;
             if(mgr.Value != mgr.GetCall() || !mgr.Validate(out err, out mod))
             {
                 return "Must either be empty or a valid callsign";
             }
         }
         return null;
     }
 }