コード例 #1
0
        public void FindCardsDataTest001_SampleDeck()
        {
            string data = File.ReadAllText("./Services/Data/DeckImportTest001.txt");
            Mock <ITrackerFactory> trackerFactory = new Mock <ITrackerFactory>();
            Mock <ICardsDatabase>  cardsDatabase  = new Mock <ICardsDatabase>();

            cardsDatabase.Setup(cb => cb.FindCardByName(It.IsAny <string>())).Returns(new DataModel.Card());
            trackerFactory.Setup(tf => tf.GetService <ICardsDatabase>()).Returns(cardsDatabase.Object);

            var di = new DeckImporter(trackerFactory.Object);

            di.Cards = new List <DataModel.CardInstance>();
            data     = di.FindCardsData(data);
            di.ImportFromTextProcess(data);

            Assert.IsTrue(di.Cards.Count > 0);
            Assert.AreEqual(50, di.Cards.Sum(c => c.Quantity));
        }