/// <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; }
public void TestGetCallSuffix() { Call call = new Call("VA3HJ/P"); Assert.AreEqual("VA3HJ", call.GetCall()); }
public void TestGetCallVP2E() { Call call = new Call("VP2E"); Assert.AreEqual("VP2E", call.GetCall()); }
public void TestGetCallPrefix() { Call call = new Call("9A5/VA3HJ"); Assert.AreEqual("VA3HJ", call.GetCall()); }
public void TestGetCallR1FJPrefix() { Call call = new Call("R1FJ/UA0BMD"); Assert.AreEqual("UA0BMD", call.GetCall()); }
public void TestGetCallNone() { Call call = new Call("VA3HJ"); Assert.AreEqual("VA3HJ", call.GetCall()); }
public void TestGetCallInvalidCall() { Call call = new Call("VAHJ"); Assert.AreEqual(null, call.GetCall()); }
public void TestGetCall5C5CW() { Call call = new Call("5C5CW"); Assert.AreEqual("5C5CW", call.GetCall()); }
public void TestGetCallXM31812() { Call call = new Call("XM31812"); Assert.AreEqual("XM31812", call.GetCall()); }
/// <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; } }