예제 #1
0
 public void TestModifyValues2VCreditsGranted()
 {
     string err = string.Empty;
     string modStr = string.Empty;
     Qso2 qso = new Qso2("<Credit_Granted:14>DXCC:CARD&LOTW<Eqsl_Qsl_Rcvd:1>V",
                         aEnums, ref err);
     Assert.IsNull(err);
     Eqsl_Qsl_Rcvd rcvd = qso.GetField("Eqsl_Qsl_Rcvd") as Eqsl_Qsl_Rcvd;
     Assert.IsNotNull(rcvd);
     modStr = rcvd.ModifyValues2(qso);
     rcvd = qso.GetField("Eqsl_Qsl_Rcvd") as Eqsl_Qsl_Rcvd;
     Assert.IsNull(rcvd);
     Assert.AreEqual("\tValue 'V' is deprecated and replaced with Credit_Granted values: " +
                     "'DXCC:EQSL', 'DXCC_BAND:EQSL', and 'DXCC_MODE:EQSL'." +
                     Environment.NewLine, modStr);
     Credit_Granted granted = qso.GetField("Credit_Granted") as Credit_Granted;
     Assert.IsNotNull(granted);
     List<Credit> credits = granted.GetCredits("DXCC");
     Assert.AreEqual(1, credits.Count);
     Assert.AreEqual("DXCC:CARD&LOTW&EQSL", credits[0].ToString());
     Assert.IsTrue(credits[0].IsInMedia("EQSL"));
     credits = granted.GetCredits("DXCC_BAND");
     Assert.IsTrue(credits[0].IsInMedia("EQSL"));
     credits = granted.GetCredits("DXCC_Mode");
     Assert.IsTrue(credits[0].IsInMedia("eqsl"));
 }
예제 #2
0
 public void TestModifyValuesWithOperatorField()
 {
     string err = string.Empty;
     Qso2 qso = new Qso2("<Guest_Op:5>VA3HJ<Operator:6>VA3JNO", aEnums, ref err);
     Guest_Op guest = qso.GetField("Guest_Op") as Guest_Op;
     string mod = guest.ModifyValues(qso);
     guest = qso.GetField("Guest_Op") as Guest_Op;
     Assert.IsNull(guest);
     Assert.AreEqual("\tGuest_Op field cannot be changed to Operator field because Operator field already exists. Guest_Op field deleted." +
                     Environment.NewLine, mod);
 }
예제 #3
0
 public void TestModifyValuesNull()
 {
     string err = string.Empty;
     Qso2 qso = new Qso2("<Lotw_QslSDate:8>20120916", aEnums, ref err);
     Lotw_QslSDate date = qso.GetField("Lotw_QslSDate") as Lotw_QslSDate;
     Assert.IsNotNull(date);
     err = date.ModifyValues(qso);
     date = qso.GetField("Lotw_QslSDate") as Lotw_QslSDate;
     Assert.IsNull(date);
     Assert.AreEqual("\tLotw_QslSDate field deleted. This field is only valid when Lotw_Qsl_Sent field is Y, Q, or I." +
                      Environment.NewLine, err);
 }
예제 #4
0
 public void TestModifyValuesNull()
 {
     string err = string.Empty;
     Qso2 qso = new Qso2("<Eqsl_QslRDate:8>20120916", aEnums, ref err);
     Eqsl_QslRDate date = qso.GetField("Eqsl_QslRDate") as Eqsl_QslRDate;
     Assert.IsNotNull(date);
     err = date.ModifyValues(qso);
     date = qso.GetField("Eqsl_QslRDate") as Eqsl_QslRDate;
     Assert.IsNull(date);
     Assert.AreEqual("\tEqsl_QslRDate field deleted. This field is only valid when Eqsl_Qsl_Rcvd field is Y, I, or V." +
                      Environment.NewLine, err);
 }
예제 #5
0
 public void TestModifyValuesMStatus()
 {
     string err = string.Empty;
     string modStr = string.Empty;
     Qso2 qso = new Qso2("<Qsl_Rcvd_Via:1>M", aEnums, ref err);
     Qsl_Rcvd_Via status = qso.GetField("Qsl_Rcvd_Via") as Qsl_Rcvd_Via;
     Assert.IsNotNull(status);
     string mod = status.ModifyValues(qso);
     Assert.AreEqual("\tQsl_Rcvd_Via value 'M' deprecated with no replacement value. Field deleted."
                     + Environment.NewLine, mod);
     status = qso.GetField("Qsl_Rcvd_Via") as Qsl_Rcvd_Via;
     Assert.IsNull(status);
 }
예제 #6
0
 public void TestModifyValuesEStatus()
 {
     string err = string.Empty;
     string modStr = string.Empty;
     Qso2 qso = new Qso2("<Qsl_Rcvd_Via:1>E", aEnums, ref err);
     Qsl_Rcvd_Via status = qso.GetField("Qsl_Rcvd_Via") as Qsl_Rcvd_Via;
     Assert.IsNotNull(status);
     string mod = status.ModifyValues(qso);
     Assert.IsNull(mod);
     status = qso.GetField("Qsl_Rcvd_Via") as Qsl_Rcvd_Via;
     Assert.IsNotNull(status);
     Assert.AreEqual("E", status.Value);
 }
예제 #7
0
 public void TestModifyValuesWithOwnerCallsign()
 {
     string err = string.Empty;
     Qso2 qso = new Qso2("<Station_Callsign:5>VA3HJ<Owner_Callsign:6>VA3JNO", aEnums, ref err);
     Station_Callsign call = qso.GetField("Station_Callsign") as Station_Callsign;
     Assert.IsNotNull(call);
     string mod = call.ModifyValues(qso);
     Owner_Callsign owner = qso.GetField("Owner_Callsign") as Owner_Callsign;
     Assert.IsNotNull(owner);
     Assert.AreNotEqual(call.Value, owner.Value);
     Assert.AreEqual("VA3JNO", owner.Value);
     Assert.IsNull(mod);
 }
예제 #8
0
 public void TestModifyValuesNoState()
 {
     string err = string.Empty;
     Qso2 qso = new Qso2("<VE_PROV:2>ON", aEnums, ref err);
     VE_Prov prov = qso.GetField("VE_Prov") as VE_Prov;
     Assert.IsNotNull(prov);
     string mod = prov.ModifyValues(qso);
     prov = qso.GetField("VE_Prov") as VE_Prov;
     Assert.IsNull(prov);
     State state = qso.GetField("State") as State;
     Assert.AreEqual("ON", state.Value);
     Assert.AreEqual("\tVE_Prov field deprecated. VE_Prov field deleted and replaced with State field." +
                     Environment.NewLine, mod);
 }
예제 #9
0
 public void TestModifyValuesStation_Callsign()
 {
     string err = string.Empty;
     Qso2 qso = new Qso2("<Operator:5>VA3HJ<Station_Callsign:6>VA3JNO", aEnums, ref err);
     Operator op = qso.GetField("Operator") as Operator;
     Assert.IsNotNull(op);
     err = op.ModifyValues(qso);
     op = qso.GetField("Operator") as Operator;
     Assert.IsNotNull(op);
     Assert.IsNull(err);
     Station_Callsign call = qso.GetField("Station_Callsign") as Station_Callsign;
     Assert.IsNotNull(call);
     Assert.AreEqual("VA3JNO", call.Value);
 }
예제 #10
0
 public void TestModifyValuesState()
 {
     string err = string.Empty;
     Qso2 qso = new Qso2("<VE_PROV:2>ON<STATE:2>AB", aEnums, ref err);
     VE_Prov prov = qso.GetField("VE_Prov") as VE_Prov;
     Assert.IsNotNull(prov);
     string mod = prov.ModifyValues(qso);
     prov = qso.GetField("VE_Prov") as VE_Prov;
     Assert.IsNull(prov);
     State state = qso.GetField("State") as State;
     Assert.AreEqual("AB", state.Value);
     Assert.AreEqual("\tVE_Prov field deprecated. State field already exists, so VE_Prov field deleted." +
                     Environment.NewLine, mod);
 }
예제 #11
0
        public void TestModifyValuesFalse(
			[Values("N", "R")] string rcvd)
        {
            string adif = string.Format("<Lotw_Qsl_Rcvd:1>{0}<Lotw_QslRDate:8>20120916",
             	                           rcvd);
            string err = string.Empty;
            Qso2 qso = new Qso2(adif, aEnums, ref err);
            Lotw_QslRDate date = qso.GetField("Lotw_QslRDate") as Lotw_QslRDate;
            Assert.IsNotNull(date);
            err = date.ModifyValues(qso);
            date = qso.GetField("Lotw_QslRDate") as Lotw_QslRDate;
            Assert.IsNull(date);
            Assert.AreEqual("\tLotw_QslRDate field deleted. This field is only valid when Lotw_Qsl_Rcvd field is Y, I, or V." +
                             Environment.NewLine, err);
        }
예제 #12
0
        public void TestModifyValuesFalse(
			[Values("N", "R")] string sent)
        {
            string adif = string.Format("<Qsl_Sent:1>{0}<QslSDate:8>20120916",
             	                           sent);
            string err = string.Empty;
            Qso2 qso = new Qso2(adif, aEnums, ref err);
            QslSDate date = qso.GetField("QslSDate") as QslSDate;
            Assert.IsNotNull(date);
            err = date.ModifyValues(qso);
            date = qso.GetField("QslSDate") as QslSDate;
            Assert.IsNull(date);
            Assert.AreEqual("\tQslSDate field deleted. This field is only valid when Qsl_Sent field is Y, Q, or I." +
                             Environment.NewLine, err);
        }
예제 #13
0
 public void TestModifyValuesNoOwnerCallsign()
 {
     string err = string.Empty;
     Qso2 qso = new Qso2("", aEnums, ref err);
     Station_Callsign call = new Station_Callsign("VA3HJ");
     qso.Fields.Add(call);
     Owner_Callsign owner = qso.GetField("Owner_Callsign") as Owner_Callsign;
     Assert.IsNull(owner);
     string mod = call.ModifyValues(qso);
     owner = qso.GetField("Owner_Callsign") as Owner_Callsign;
     Assert.IsNotNull(owner);
     Assert.AreEqual(call.Value, owner.Value);
     Assert.AreEqual("\tOwner_Callsign field generated from Station_Callsign" +
                     Environment.NewLine, mod);
 }
예제 #14
0
 public void TestModifyValuesNoStation_Callsign()
 {
     string err = string.Empty;
     Qso2 qso = new Qso2("<Operator:5>VA3HJ", aEnums, ref err);
     Operator op = qso.GetField("Operator") as Operator;
     Assert.IsNotNull(op);
     err = op.ModifyValues(qso);
     op = qso.GetField("Operator") as Operator;
     Assert.IsNotNull(op);
     Assert.AreEqual("\tStation_Callsign field generated from Operator field." +
                     Environment.NewLine, err);
     Station_Callsign call = qso.GetField("Station_Callsign") as Station_Callsign;
     Assert.IsNotNull(call);
     Assert.AreEqual("VA3HJ", call.Value);
 }
예제 #15
0
 public void TestModifyValuesWithInalidModeWithValidSubmode()
 {
     string err = string.Empty;
     Qso2 qso = new Qso2("<Mode:6>SQUIBB<Submode:3>LSB", aEnums, ref err);
     AdifField field = qso.GetField("Mode");
     Assert.IsNotNull(field);
     Mode mode = field as Mode;
     Assert.IsNotNull(mode);
     Assert.AreEqual("\tMode not found in Mode enumeration. Mode set to mode for submode.",
                     mode.ModifyValues(qso));
     Assert.AreEqual("SSB", mode.Value);
     Submode submode = qso.GetField("Submode") as Submode;
     Assert.IsNotNull(submode);
     Assert.AreEqual("LSB", submode.Value);
 }
예제 #16
0
 /// <summary>
 ///  Change deprecated values to their replacements
 /// 
 /// </summary>
 /// <param name="qso">Qso2 object containing this field</param>
 /// <returns>string containing message about changes made</returns>
 public override string ModifyValues2(Qso2 qso)
 {
     // this code must be in ModifyValues2, not ModifyValues, because this code changes
     // status of 'V' which must be present when Eqsl_QslRDate.ModifyValues is called.
     // We cannot guarantee the order in which objects in Qso2.Fields is stored.
     string mod = string.Empty;
     string modStr = null;
     if(Value.Equals("V"))
     {
         Credit_Granted granted = qso.GetField("Credit_Granted") as Credit_Granted;
         if(granted == null)
         {
             Credit_Granted credGranted = new Credit_Granted("DXCC:CARD,DXCC_BAND:CARD,DXCC_Mode:CARD",
                                                     aEnums);
             qso.Fields.Add(credGranted);
         }
         else
         {
             granted.Add(new Credit("DXCC:CARD", aEnums));
             granted.Add(new Credit("DXCC_BAND:CARD", aEnums));
             granted.Add(new Credit("DXCC_MODE:CARD", aEnums));
         }
         qso.Fields.Remove(this);
         modStr = "\tValue 'V' is deprecated and replaced with Credit_Granted values: 'DXCC:CARD', 'DXCC_BAND:CARD', and 'DXCC_MODE:CARD'." +
                 Environment.NewLine;
     }
     return modStr;
 }
예제 #17
0
 public void TestModifyValuesValidCall()
 {
     string err = string.Empty;
     Qso2 qso = new Qso2("<Guest_Op:5>VA3HJ", aEnums, ref err);
     Guest_Op guest = qso.GetField("Guest_Op") as Guest_Op;
     string mod = guest.ModifyValues(qso);
     guest = qso.GetField("Guest_Op") as Guest_Op;
     Assert.IsNull(guest);
     Operator op = qso.GetField("Operator") as Operator;
     Assert.IsNotNull(op);
     Station_Callsign call = qso.GetField("Station_Callsign") as Station_Callsign;
     Assert.IsNotNull(call);
     Assert.AreEqual(op.Value, call.Value);
     Assert.AreEqual("\tGuest_Op field changed to Operator field." +
                     Environment.NewLine +
                     "\tStation_Callsign field generated from Operator field." +
                     Environment.NewLine, mod);
 }
예제 #18
0
 public void TestModifyValuesWithMatchingValues()
 {
     string err = string.Empty;
     Qso2 qso = new Qso2("<Freq_Rx:6>14.263<Band_Rx:3>20m", aEnums, ref err);
     Assert.IsNull(err);
     AdifField field = qso.GetField("Freq_Rx");
     Assert.IsNotNull(field);
     Freq_Rx freq = field as Freq_Rx;
     Assert.IsNotNull(freq);
     Assert.IsNull(freq.ModifyValues(qso));
 }
예제 #19
0
 public void TestModifyNWT()
 {
     string err = string.Empty;
     Qso2 qso = new Qso2("<arrl_sect:3>NWT", aEnums, ref err);
     Arrl_Sect nwt = qso.GetField("Arrl_Sect") as Arrl_Sect;
     Assert.IsNotNull(nwt);
     string mod = nwt.ModifyValues(qso);
     Assert.AreEqual("NT", nwt.Value);
     Assert.AreEqual("\tArrl_Sect:" + Environment.NewLine +
                     "\t\tDeprecated section 'NWT' changed to 'NT'." +
                     Environment.NewLine, mod);
 }
예제 #20
0
 public void TestModifyValuesWithMisMatchedValues()
 {
     string err = string.Empty;
     Qso2 qso = new Qso2("<Freq:6>14.263<Band:3>10m", aEnums, ref err);
     Assert.IsNull(err);
     AdifField field = qso.GetField("Freq");
     Assert.IsNotNull(field);
     Freq freq = field as Freq;
     Assert.IsNotNull(freq);
     Assert.AreEqual("\tHam band in Band field does not match band for given frequency." +
                 " Band field modified to match the frequency.",
                 freq.ModifyValues(qso));
 }
예제 #21
0
 public void TestModifyValues2V()
 {
     string err = string.Empty;
     string modStr = string.Empty;
     Qso2 qso = new Qso2("<Qsl_Rcvd:1>V", aEnums,ref err);
     Qsl_Rcvd rcvd = qso.GetField("Qsl_Rcvd") as Qsl_Rcvd;
     Assert.IsNotNull(rcvd);
     modStr = rcvd.ModifyValues2(qso);
     rcvd = qso.GetField("Qsl_Rcvd") as Qsl_Rcvd;
     Assert.IsNull(rcvd);
     Assert.AreEqual("\tValue 'V' is deprecated and replaced with Credit_Granted values: " +
                     "'DXCC:CARD', 'DXCC_BAND:CARD', and 'DXCC_MODE:CARD'." +
                     Environment.NewLine, modStr);
     Credit_Granted granted = qso.GetField("Credit_Granted") as Credit_Granted;
     Assert.IsNotNull(granted);
     List<Credit> credits = granted.GetCredits("DXCC");
     Assert.IsTrue(credits[0].IsInMedia("CARD"));
     credits = granted.GetCredits("DXCC_BAND");
     Assert.IsTrue(credits[0].IsInMedia("CARD"));
     credits = granted.GetCredits("DXCC_Mode");
     Assert.IsTrue(credits[0].IsInMedia("card"));
 }
예제 #22
0
 public void TestModifyValuesEa_Rtty()
 {
     string err = string.Empty;
     string modStr = string.Empty;
     Qso2 qso = new Qso2("<contest_ID:7>EA-RTTY", aEnums, ref err);
     Contest_Id id = qso.GetField("Contest_Id") as Contest_Id;
     Assert.IsNotNull(id);
     modStr = id.ModifyValues(qso);
     Assert.AreEqual("EA-WW-RTTY", id.Value);
     Assert.AreEqual("\tContest_Id:" + Environment.NewLine +
                     "\t\tDeprecated value 'EA-RTTY' changed to 'EA-WW-RTTY'." +
                     Environment.NewLine, modStr);
 }
예제 #23
0
 /// <summary>
 /// This field is valid only if Eqsl_Qsl_Sent is Y, Q, or I.
 /// Delete field if other value or null
 /// </summary>
 /// <param name="qso">Qso2 object containing this field</param>
 /// <returns>string containing modification message</returns>
 public override string ModifyValues(Qso2 qso)
 {
     string mod = null;
     Eqsl_Qsl_Sent sent = qso.GetField("Eqsl_Qsl_Sent") as Eqsl_Qsl_Sent;
     if(sent == null || (sent.Value != "Y" && sent.Value != "Q" && sent.Value != "I"))
     {
         qso.Fields.Remove(this);
         mod = "\tEqsl_QslSDate field deleted. This field is only valid when " +
                 "Eqsl_Qsl_Sent field is Y, Q, or I." +
                 Environment.NewLine;
     }
     return mod;
 }
예제 #24
0
 /// <summary>
 /// This field is valid only if Eqsl_Qsl_Rcvd is Y, I, or V.
 /// Delete field if other value or null
 /// </summary>
 /// <param name="qso">Qso2 object containing this field</param>
 /// <returns>string containing modification message</returns>
 public override string ModifyValues(Qso2 qso)
 {
     string mod = null;
     Eqsl_Qsl_Rcvd rcvd = qso.GetField("Eqsl_Qsl_Rcvd") as Eqsl_Qsl_Rcvd;
     if(rcvd == null || (rcvd.Value != "Y" && rcvd.Value != "I" && rcvd.Value != "V"))
     {
         qso.Fields.Remove(this);
         mod = "\tEqsl_QslRDate field deleted. This field is only valid when " +
                 "Eqsl_Qsl_Rcvd field is Y, I, or V." +
                 Environment.NewLine;
     }
     return mod;
 }
예제 #25
0
 /// <summary>
 /// Generate Station_Callsign field from this field, if does not exist
 /// </summary>
 /// <param name="qso">Qso2 object containing this field</param>
 /// <returns>string describing the modification made</returns>
 public override string ModifyValues(Qso2 qso)
 {
     string mod = null;
     Station_Callsign call = qso.GetField("Station_Callsign") as Station_Callsign;
     if(call == null)
     {
         call = new Station_Callsign(Value);
         qso.Fields.Add(call);
         call.ModifyValues(qso);
         mod = "\tStation_Callsign field generated from Operator field." +
                     Environment.NewLine;
     }
     return mod;
 }
예제 #26
0
 /// <summary>
 /// Generate Owner_Callsign field if it does not exist
 /// </summary>
 /// <param name="qso">Qso2 object containing this field</param>
 /// <returns>string indicating changes made</returns>
 public override string ModifyValues(Qso2 qso)
 {
     string mod = null;
     Owner_Callsign owner = qso.GetField("Owner_Callsign") as Owner_Callsign;
     if(owner == null)
     {
         owner = new Owner_Callsign(Value);
         qso.Fields.Add(owner);
         owner.ModifyValues(qso);
         mod = "\tOwner_Callsign field generated from Station_Callsign" +
                     Environment.NewLine;
     }
     return mod;
 }
예제 #27
0
 public void TestModifyValuesWithInvalidModeNoSubmode()
 {
     string err = string.Empty;
     Qso2 qso = new Qso2("<Mode:6>SQUIBB", aEnums, ref err);
     AdifField field = qso.GetField("Mode");
     Assert.IsNotNull(field);
     Mode mode = field as Mode;
     Assert.IsNotNull(mode);
     Assert.AreEqual("\tMode not found in Mode enumeration. Submode set to mode value and mode cleared.",
                     mode.ModifyValues(qso));
     Assert.AreEqual(null, qso["Mode"]);
     Submode submode = qso.GetField("Submode") as Submode;
     Assert.IsNotNull(submode);
     Assert.AreEqual("SQUIBB", submode.Value);
 }
예제 #28
0
 public void TestAddMediumToExistingCredit()
 {
     string err = string.Empty;
     Qso2 qso = new Qso2("<Credit_Granted:49>DXCC:CARD&LOTW,DXCC_MODE:CARD&LOTW,DXCC_BAND:CARD",
                         aEnums, ref err);
     Credit_Granted granted = qso.GetField("Credit_Granted") as Credit_Granted;
     List<Credit> creds = granted.GetCredits("DXCC");
     Assert.AreEqual(1, creds.Count);
     Assert.AreEqual(2, creds[0].Media.Count);
     Assert.AreEqual("DXCC:CARD&LOTW", creds[0].ToString());
     granted.Add(new Credit("DXCC:EQSL", aEnums));
     creds = granted.GetCredits("DXCC");
     Assert.AreEqual(3, creds[0].Media.Count);
     Assert.AreEqual("DXCC:CARD&LOTW&EQSL", creds[0].ToString());
     Assert.IsTrue(creds[0].IsInMedia("EQSL"));
 }
예제 #29
0
        /// <summary>
        /// Change VE_PROV to STATE
        /// </summary>
        /// <param name="qso">Qso2 object containing this field</param>
        /// <returns>string indicating the change made</returns></returns>
        public override string ModifyValues(Qso2 qso)
        {
            string mod = null;
            State state = qso.GetField("State") as State;
            if(state == null)
            {
                state = new State(Value);
                qso.Fields.Add(state);
                mod = "\tVE_Prov field deprecated. VE_Prov field deleted and replaced with State field." +
                    Environment.NewLine;
                state.ModifyValues(qso);

            }
            else
            {
                mod = "\tVE_Prov field deprecated. State field already exists, so VE_Prov field deleted." +
                            Environment.NewLine;
            }
            qso.Fields.Remove(this);
            return mod;
        }
예제 #30
0
 /// <summary>
 /// Delete this field and change to Operator field if that does not already exist.
 /// </summary>
 /// <param name="qso">Qso2 object containing this field</param>
 /// <returns>Message indicating any modifications made</returns>
 public override string ModifyValues(Qso2 qso)
 {
     string mod = null;
     Operator op = qso.GetField("Operator") as Operator;
     if(op == null)
     {
         op = new Operator(Value);
         qso.Fields.Add(op);
         mod = "\tGuest_Op field changed to Operator field." +
                     Environment.NewLine;
         string mod2 = op.ModifyValues(qso);
         if(mod2 != null)
         {
             mod += mod2;
         }
     }
     else
     {
         mod = "\tGuest_Op field cannot be changed to Operator field because Operator field already exists. Guest_Op field deleted." +
                		Environment.NewLine;
     }
     qso.Fields.Remove(this);
     return mod;
 }