Ejemplo n.º 1
0
 public void TestAddMediumToExistingCredit()
 {
     CreditList credits = new CreditList("DXCC:CARD&LOTW", aEnums);
     List<Credit> creds = credits.GetCredits("DXCC");
     Assert.AreEqual(1, creds.Count);
     Assert.AreEqual("DXCC:CARD&LOTW", creds[0].ToString());
     credits.Add(new Credit("DXCC:EQSL", aEnums));
     creds = credits.GetCredits("DXCC");
     Assert.AreEqual("DXCC:CARD&LOTW&EQSL", creds[0].ToString());
     Assert.IsTrue(creds[0].IsInMedia("EQSL"));
     Assert.IsTrue(creds[0].IsInMedia("LOTW"));
     Assert.IsTrue(creds[0].IsInMedia("CARD"));
 }
Ejemplo n.º 2
0
 public void TestAddSingleCredit()
 {
     Credit credit = new Credit("IOTA", aEnums);
     CreditList list = new CreditList();
     list.Add(credit);
     Assert.AreEqual(1, list.Count);
     List<Credit> credits = list.GetCredits("IOTA");
     Assert.AreEqual(1, credits.Count);
     Assert.AreEqual("IOTA", credits[0].CreditName);
     string[] media = new string[credits[0].Media.Count];
     credits[0].Media.CopyTo(media);
     Assert.AreEqual(null, media[0]);
 }
Ejemplo n.º 3
0
 public void TestValidateValidSingleCredit()
 {
     CreditList credit = new CreditList("IOTA", aEnums);
     string err = string.Empty;
     string modStr = string.Empty;
     Assert.IsTrue(credit.Validate(out err, out modStr));
     Assert.IsNull(err);
     Assert.IsNull(modStr);
 }
Ejemplo n.º 4
0
 public void TestValidateValidMultipleCredits()
 {
     CreditList credit = new CreditList("IOTA,DXCC_BAND,DXCC_MODE", aEnums);
     string err = string.Empty;
     string modStr = string.Empty;
     Assert.IsTrue(credit.Validate(out err, out modStr));
     Assert.IsNull(err);
     Assert.IsNull(modStr);
 }
Ejemplo n.º 5
0
 public void TestValidateInvalidSingleCreditInList()
 {
     CreditList credit = new CreditList("IOTA,DXCC_BANE,DXCC_MODE", aEnums);
     string err = string.Empty;
     string modStr = string.Empty;
     Assert.IsFalse(credit.Validate(out err, out modStr));
     Assert.AreEqual("\t'DXCC_BANE' not found in Credit enumeration", err);
     Assert.IsNull(modStr);
 }
Ejemplo n.º 6
0
 public void TestToAdifString4Credits()
 {
     CreditList list = new CreditList("WAS:LOTW,IOTA,DXCC_BAND:LOTW&CARD,DXCC_MODE:LOTW&CARD", aEnums);
     Assert.AreEqual("<CreditList:53>WAS:LOTW,IOTA,DXCC_BAND:LOTW&CARD,DXCC_MODE:LOTW&CARD", list.ToAdifString());
 }
Ejemplo n.º 7
0
 public void TestToAdifString1Credit()
 {
     CreditList list = new CreditList("IOTA", aEnums);
     Assert.AreEqual("<CreditList:4>IOTA", list.ToAdifString());
 }
Ejemplo n.º 8
0
 public void TestToAdifString0Credits()
 {
     CreditList list = new CreditList();
     Assert.AreEqual("<CreditList:0>", list.ToAdifString());
 }
Ejemplo n.º 9
0
 public void TestAddTwoCreditsNullAndMedium()
 {
     Credit credit = new Credit("IOTA", aEnums);
     CreditList list = new CreditList();
     list.Add(credit);
     Assert.AreEqual(1, list.Count);
     Credit c2 = new Credit("IOTA:CARD", aEnums);
     list.Add(c2);
     Assert.AreEqual(2, list.Count);
     List<Credit> credits = list.GetCredits("IOTA");
     Assert.AreEqual(2, credits.Count);
     Assert.AreEqual("IOTA", credits[0].CreditName);
     string[] media = new string[credits[0].Media.Count];
     credits[0].Media.CopyTo(media);
     Assert.AreEqual(null, media[0]);
     media = new string[credits[1].Media.Count];
     credits[1].Media.CopyTo(media);
     Assert.AreEqual(1, media.Length);
     Assert.AreEqual("CARD", media[0]);
 }
Ejemplo n.º 10
0
 public void TestReplaceAwardsWithCreditsNoReplacementAward()
 {
     CreditList credit = new CreditList("IOTA,JCG,CQWAZ_CW", aEnums);
     string err = string.Empty;
     credit.ReplaceAwardsWithCredits(ref err);
     Assert.AreEqual("<CreditList:15>IOTA,CQWAZ_MODE", credit.ToAdifString());
     Assert.AreEqual("\t\tAward 'JCG' deleted because there is no equivalent Credit." +
                     Environment.NewLine +
                     "\t\tAward 'CQWAZ_CW' replaced with Credit 'CQWAZ_MODE'." +
                     Environment.NewLine, err);
 }
Ejemplo n.º 11
0
 public void TestReplaceAwardsWithCreditsAwardReplacementSameAsCreditWithoutMedium()
 {
     CreditList credit = new CreditList("IOTA,JCG,CQWAZ_CW,CQWAZ_MODE:CARD&LOTW", aEnums);
     string err = string.Empty;
     credit.ReplaceAwardsWithCredits(ref err);
     Assert.AreEqual("<CreditList:36>IOTA,CQWAZ_MODE,CQWAZ_MODE:CARD&LOTW", credit.ToAdifString());
 }
Ejemplo n.º 12
0
 public void TestReplaceAwardsWithCreditsAwardAndCredits()
 {
     CreditList credit = new CreditList("IOTA,DXCC_BAND,CQWAZ_CW", aEnums);
     string err = string.Empty;
     credit.ReplaceAwardsWithCredits(ref err);
     Assert.AreEqual("<CreditList:25>IOTA,DXCC_BAND,CQWAZ_MODE", credit.ToAdifString());
     Assert.AreEqual("\t\tAward 'CQWAZ_CW' replaced with Credit 'CQWAZ_MODE'." +
                     Environment.NewLine, err);
 }
Ejemplo n.º 13
0
 public void TestGetCreditsTwoMatchingCredits()
 {
     Credit credit = new Credit("IOTA", aEnums);
     CreditList list = new CreditList();
     list.Add(credit);
     Credit notIOTA = new Credit("WAS", aEnums);
     list.Add(notIOTA);
     Credit credit2 = new Credit("IOTA:Card&Lotw", aEnums);
     list.Add(credit2);
     List<Credit> credits = list.GetCredits("IOTA");
     Assert.AreEqual(2, credits.Count);
     Assert.AreEqual("IOTA", credits[0].CreditName);
     string[] media = new string[credits[0].Media.Count];
     credits[0].Media.CopyTo(media);
     Assert.AreEqual(null, media[0]);
     Assert.AreEqual("IOTA", credits[1].CreditName);
     media = new string[credits[1].Media.Count];
     credits[1].Media.CopyTo(media);
     Assert.AreEqual("CARD", media[0]);
     Assert.AreEqual("LOTW", media[1]);
 }
Ejemplo n.º 14
0
 public void TestGetCreditsNoMatchingCredits()
 {
     Credit credit = new Credit("IOTA", aEnums);
     CreditList list = new CreditList();
     list.Add(credit);
     Credit notIOTA = new Credit("WAS", aEnums);
     list.Add(notIOTA);
     Credit credit2 = new Credit("IOTA:Card&Lotw", aEnums);
     list.Add(credit2);
     List<Credit> credits = list.GetCredits("WAB");
     Assert.AreEqual(0, credits.Count);
 }
Ejemplo n.º 15
0
 public void TestConstructorWithString4Credits()
 {
     CreditList list = new CreditList("WAS:LOTW,IOTA,DXCC_BAND:LOTW&CARD,DXCC_MODE:LOTW&CARD",
                                     aEnums);
     Assert.AreEqual(4, list.Count);
 }
Ejemplo n.º 16
0
 public void TestConstructorWithString1CreditNoMedia()
 {
     CreditList list = new CreditList("IOTA", aEnums);
     Assert.AreEqual(1, list.Count);
 }
Ejemplo n.º 17
0
 public void TestReplaceAwardsWithCreditsOnlyCredits()
 {
     CreditList credit = new CreditList("IOTA,DXCC_BAND,DXCC_MODE", aEnums);
     string err = string.Empty;
     credit.ReplaceAwardsWithCredits(ref err);
     Assert.AreEqual("<CreditList:24>IOTA,DXCC_BAND,DXCC_MODE", credit.ToAdifString());
     Assert.IsNull(err);
 }
Ejemplo n.º 18
0
 public void TestAddTwoCreditsDifferentMedia()
 {
     Credit credit = new Credit("IOTA:EQSL&LOTW", aEnums);
     CreditList list = new CreditList();
     list.Add(credit);
     Credit c2 = new Credit("IOTA:CARD", aEnums);
     list.Add(c2);
     Assert.AreEqual(1, list.Count);
     List<Credit> credits = list.GetCredits("IOTA");
     Assert.AreEqual(1, credits.Count);
     Assert.AreEqual("IOTA", credits[0].CreditName);
     string[] media = new string[credits[0].Media.Count];
     credits[0].Media.CopyTo(media);
     Assert.AreEqual(3, media.Length);
     Assert.AreEqual("EQSL", media[0]);
     Assert.AreEqual("LOTW", media[1]);
     Assert.AreEqual("CARD", media[2]);
 }