Exemple #1
0
        public void FilterDeckListTest001_FilterByClass()
        {
            DeckClass selectedClass   = DeckClass.Mage;
            var       filteredClasses = new ObservableCollection <DeckClass>(new List <DeckClass>()
            {
                selectedClass
            });

            int expectedCount = 3;

            DeckListViewModel model = new DeckListViewModel();

            IEnumerable <Deck> result = model.FilterDeckList(
                DeckBase,
                null,
                false,
                false,
                selectedClass,
                filteredClasses,
                null);

            Assert.AreEqual(expectedCount, result.Count());
            Assert.AreEqual(selectedClass, result.ToList()[0].Class);
            Assert.AreEqual(selectedClass, result.ToList()[1].Class);
            Assert.AreEqual(selectedClass, result.ToList()[2].Class);
        }
Exemple #2
0
        public void FilterDeckListTest006_FilterByClassAndDeckType()
        {
            DeckClass classFilter     = DeckClass.Mage;
            var       filteredClasses = new ObservableCollection <DeckClass>(new List <DeckClass>()
            {
                classFilter
            });

            List <DeckType> typeFilter = new List <DeckType>()
            {
                DeckType.SoloArena
            };
            var filteredTypes = new ObservableCollection <DeckType>(typeFilter);

            int expectedCount = 2;

            DeckListViewModel model = new DeckListViewModel();

            IEnumerable <Deck> result = model.FilterDeckList(
                DeckBase,
                filteredTypes,
                false,
                false,
                classFilter,
                filteredClasses,
                null);

            Assert.AreEqual(expectedCount, result.Count());
            Assert.AreEqual(classFilter, result.ToList()[0].Class);
            Assert.AreEqual(classFilter, result.ToList()[1].Class);
            Assert.AreEqual(typeFilter[0], result.ToList()[0].Type);
            Assert.AreEqual(typeFilter[0], result.ToList()[1].Type);
        }
Exemple #3
0
        public void FilterDeckListTest007_HideCompletedVersusArenaRuns()
        {
            DeckClass classFilter     = DeckClass.Mage;
            var       selectedClass   = classFilter;
            var       filteredClasses = new ObservableCollection <DeckClass>(new List <DeckClass>()
            {
                classFilter
            });

            List <DeckType> typeFilter = new List <DeckType>()
            {
                DeckType.VersusArena
            };
            var filteredTypes          = new ObservableCollection <DeckType>(typeFilter);
            var showCompletedArenaRuns = false;

            Mock <ITracker>        tracker        = new Mock <ITracker>();
            Mock <ITrackerFactory> trackerFactory = new Mock <ITrackerFactory>();

            trackerFactory.Setup(tf => tf.GetNewGuid()).Returns(() => Guid.NewGuid());
            trackerFactory.Setup(tf => tf.GetTracker()).Returns(tracker.Object);
            trackerFactory.Setup(tf => tf.GetService <IDeckService>()).Returns(new DeckService(trackerFactory.Object));


            Deck deckToShow = new Deck(trackerFactory.Object)
            {
                Type = DeckType.VersusArena, Class = classFilter
            };
            Deck deckToHide = new Deck(trackerFactory.Object)
            {
                Type = DeckType.VersusArena, Class = classFilter
            };

            tracker.Setup(t => t.Games).Returns(
                new ObservableCollection <DataModel.Game>(
                    GenerateGamesList(deckToShow, 2, 2).Union(GenerateGamesList(deckToHide, 7, 2))
                    ));

            int expectedCount = 1;

            DeckListViewModel model = new DeckListViewModel();

            IEnumerable <Deck> result = model.FilterDeckList(
                new Deck[] { deckToShow, deckToHide },
                filteredTypes,
                showCompletedArenaRuns,
                false,
                selectedClass,
                filteredClasses,
                null);

            Assert.AreEqual(expectedCount, result.Count());
            Assert.AreEqual(deckToShow.DeckId, result.First().DeckId);
        }
Exemple #4
0
    private DeckClass _deck; //!< 山札

    #endregion Fields

    #region Methods

    /// <summary>
    /// Awake
    /// </summary>
    public override void Awake()
    {
        base.Awake();
        _deck = new DeckClass();
        // 山札の作成
        _deck.Awake();

        // カード背景画像がなければ取ってくる
        if (cardBackImg.Count <= 0) {
            cardBackImg.Add(Resources.Load<Texture>("Textures/BackIll"));
            cardBackImg.Add(Resources.Load<Texture>("Textures/cardBack"));
        }
    }
        private void CreateOpponentHeatMapData(IEnumerable <DeckStatsDataRecord> totalOpponents)
        {
            opponentClassHeatMap = new ChartValues <HeatPoint>();

            foreach (var r in totalOpponents)
            {
                DeckClass dc = (DeckClass)Enum.Parse(typeof(DeckClass), r.Opp);
                DataModel.DeckAttributes da  = ClassAttributesHelper.Classes[dc];
                DeckAttribute            da1 = da[0];
                DeckAttribute            da2 = (da.Count > 1 ? da[1] : da[0]);
                opponentClassHeatMap.Add(new HeatPoint((int)da1, (int)da2, Int32.Parse(r.Win)));
            }
        }
        public void FindClassByAttributeTest001()
        {
            List <DeckAttribute> filter = new List <DeckAttribute>()
            {
                DeckAttribute.Strength,
                DeckAttribute.Intelligence
            };
            DeckClass expected = DeckClass.Battlemage;

            IEnumerable <DeckClass> result = ClassAttributesHelper.FindClassByAttribute(filter);

            TestContext.WriteLine("Result:");
            foreach (DeckClass dc in result)
            {
                TestContext.WriteLine(dc + ",");
            }

            Assert.AreEqual(1, result.Count());
            Assert.AreEqual(expected, result.ElementAt(0));
        }
 public DeckAttributes(DeckClass deckClass, IEnumerable <DeckAttribute> collection) : base(collection)
 {
     this.deckClass = deckClass;
 }
 public DeckAttributes(DeckClass deckClass)
 {
     this.deckClass = deckClass;
 }