Example #1
0
        /// <summary>
        /// Parses and verifies the card count of the deck filename.  The filename must match
        /// those found in /DeckFiles/
        /// </summary>
        /// <param name="deckFileName">The filename of the deck to verify</param>
        /// <param name="scratchDirectory">The directory to create the deck file in</param>
        /// <param name="game">The Game that should be chosen in the Wizard</param>
        public static void VerifyDeckFile(
            string deckFileName,
            IEnumerable <ExpectedDeckSection> expectedSectionsStats,
            string scratchDirectory,
            Octgn.DataNew.Entities.Game game)
        {
            Assert.IsTrue(DeckFileResourceHelpers.CopyDeckFileResourceToDirectory(
                              scratchDirectory,
                              deckFileName));

            ConverterDeck converterDeck = ConvertDeckFileUsingWizard(Path.Combine(scratchDirectory, deckFileName), game);

            foreach (ConverterSection converterSection in converterDeck.ConverterSections)
            {
                ExpectedDeckSection expectedSectionStats =
                    expectedSectionsStats.First(eds => eds.SectionName == converterSection.SectionName);

                Assert.AreEqual(expectedSectionStats.TotalCardCount, converterSection.SectionCount);
                Assert.AreEqual(expectedSectionStats.UniqueCardCount, converterSection.SectionMappings.Count(sm => sm.PotentialOCTGNCards.Count > 0));

                foreach (ConverterMapping converterMapping in converterSection.SectionMappings)
                {
                    // At least one potential match should have been found
                    Assert.IsTrue(converterMapping.PotentialOCTGNCards.Count() > 0);
                }
            }
        }
Example #2
0
        /// <summary>
        /// Parses and verifies the card count of the deck URL.
        /// </summary>
        /// <param name="deckURL">The URL of the deck to verify</param>
        /// <param name="scratchDirectory">The directory to create the deck file in</param>
        /// <param name="game">The Game that should be chosen in the Wizard</param>
        public static void VerifyURL(
            string deckURL,
            IEnumerable <ExpectedDeckSection> expectedSectionsStats,
            Octgn.DataNew.Entities.Game game)
        {
            ConverterDeck converterDeck = ConvertURLUsingWizard(deckURL, game);

            foreach (ConverterSection converterSection in converterDeck.ConverterSections)
            {
                ExpectedDeckSection expectedSectionStats =
                    expectedSectionsStats.First(eds => eds.SectionName == converterSection.SectionName);

                Assert.AreEqual(expectedSectionStats.TotalCardCount, converterSection.SectionCount);
                Assert.AreEqual(expectedSectionStats.UniqueCardCount, converterSection.SectionMappings.Count(sm => sm.PotentialOCTGNCards.Count > 0));

                foreach (ConverterMapping converterMapping in converterSection.SectionMappings)
                {
                    // At least one potential match should have been found
                    Assert.IsTrue(converterMapping.PotentialOCTGNCards.Count() > 0);
                }
            }
        }