public void TestGetNoFieldWithDefault() { Qso2 qso = new Qso2("<Call:6>VA3JNO<Mode:3>SSB<Freq:5>7.235<qso_date:8>20130615<time_on:6>124316<name:3>Jim", aEnums, ref errorString); Assert.IsTrue(qso.Validate(ref errorString)); Assert.AreEqual("CW", qso["mode2", "CW"]); }
public void TestToAdifString() { Qso2 qso = new Qso2("<Call:6>VA3JNO<Mode:3>SSB<Freq:5>7.235<qso_date:8>20130615<time_on:6>124316", aEnums, ref errorString); Assert.IsTrue(qso.Validate(ref errorString)); Assert.AreEqual("<Call:6>VA3JNO<Mode:3>SSB<Freq:5>7.235<Qso_Date:8>20130615<Time_On:6>124316<eor>", qso.ToAdifString()); }
public void TestGetAdifFieldNoField() { Qso2 qso = new Qso2("<Call:6>VA3JNO<Mode:3>SSB<Freq:5>7.235<qso_date:8>20130615<time_on:6>124316<name:3>Jim", aEnums, ref errorString); Assert.IsTrue(qso.Validate(ref errorString)); Assert.IsNull(qso.GetField("time_off")); }
public void TestEqualsWithEqualQsos() { Qso2 qso = new Qso2("<Call:6>VA3JNO<Mode:3>SSB<Freq:5>7.235<qso_date:8>20130615<time_on:6>124316", aEnums, ref errorString); Assert.IsTrue(qso.Validate(ref errorString)); Qso2 q2 = new Qso2("<Call:6>VA3JNO<Mode:3>SSB<Freq:5>7.235<qso_date:8>20130615<time_on:6>124316", aEnums, ref errorString); Assert.IsTrue(q2.Validate(ref errorString)); Assert.IsTrue(qso.Equals(q2)); }
public void TestEqualsWithDiffField() { Qso2 qso = new Qso2("<Call:6>VA3JNO<Mode:3>SSB<Freq:5>7.235<qso_date:8>20130615<time_on:6>124316<name:3>Jim", aEnums, ref errorString); Assert.IsTrue(qso.Validate(ref errorString)); Qso2 q2 = new Qso2("<Call:6>VA3JNO<Mode:3>SSB<Freq:5>7.235<qso_date:8>20130615<time_on:6>124316<time_off:6>124522", aEnums, ref errorString); Assert.IsTrue(q2.Validate(ref errorString)); Assert.IsFalse(qso.Equals(q2)); }
public void TestValidateValidWithFreq( [Values("<Call:6>VA3JNO<Mode:3>SSB<Freq:5>7.235<qso_date:8>20130615<time_on:6>124316", "<Call:6>VA3JNO<Mode:3>SSB<band:3>40m<qso_date:8>20130615<time_on:6>124316")] string q) { Qso2 qso = new Qso2(q, aEnums, ref errorString); Assert.IsTrue(qso.Validate(ref errorString)); Assert.AreEqual(null, errorString); }
public void TestValidateRequiredFieldMissing( [Values("<Mode:3>SSB<Freq:5>7.235<qso_date:8>20130615<time_on:6>124316", "<Call:6>VA3JNO<band:3>40m<qso_date:8>20130615<time_on:6>124316", "<Call:6>VA3JNO<Mode:3>SSB<qso_date:8>20130615<time_on:6>124316", "<Call:6>VA3JNO<Mode:3>SSB<band:3>40m<time_on:6>124316", "<Call:6>VA3JNO<Mode:3>SSB<band:3>40m<qso_date:8>20130615")] string q, [Values("\tInvalid QSO: Call not specified.", "\tInvalid QSO: Mode and submode not specified.", "\tInvalid QSO: Neither a band or frequency specified.", "\tInvalid QSO: Qso_Date not specified.", "\tInvalid QSO: Time_On not specified.")] string errMsg) { Qso2 qso = new Qso2(q, aEnums, ref errorString); Assert.AreEqual(null, errorString); Assert.IsFalse(qso.Validate(ref errorString)); Assert.AreEqual(errMsg, errorString); }