Ejemplo n.º 1
0
        public void Price_can_be_temporarily_set()
        {
            var card = _repo.CardsByName["plains"][0];

            using var tempPrice = TemporaryPrice.Set(card, 1f);
            Assert.That(card.Price, Is.Not.Null);
        }
Ejemplo n.º 2
0
        public void Known_price_is_preferred()
        {
            const string name  = "Snow-Covered Plains";
            const int    count = 1;

            var cardVariants = _repo.CardsByName[name];

            var cardKnownPrice = cardVariants[0];

            using var tempPrice = TemporaryPrice.Set(cardKnownPrice, 1f);
            var cardUnknownPrice = cardVariants[1];

            cardKnownPrice.Price.Should().NotBeNull();
            cardUnknownPrice.Price.Should().BeNull();

            _deckEditor.Add(cardUnknownPrice, count);

            var deck       = _deckEditor.Snapshot();
            var collection = _collectionEditor.Snapshot();

            var transformed = _transformation.Transform(deck, collection);

            Assert.That(transformed.MainDeck.Count.ContainsKey(cardKnownPrice.Id));
            Assert.That(transformed.MainDeck.Count[cardKnownPrice.Id], Is.EqualTo(count));
            Assert.That(transformed.MainDeck.Count.ContainsKey(cardUnknownPrice.Id), Is.False);
        }
Ejemplo n.º 3
0
        public void Known_price_is_preferred()
        {
            const string name  = "Snow-Covered Plains";
            const int    count = 1;

            var cardVariants = _repo.CardsByName[name];

            var cardKnownPrice   = cardVariants.First(c => c.PricingMid.HasValue);
            var cardUnknownPrice = cardVariants.FirstOrDefault(c => !c.PriceMid.HasValue) ??
                                   cardVariants.First(c => c != cardKnownPrice);

            _deckEditor.Add(cardUnknownPrice, count);

            var deck       = _deckEditor.Snapshot();
            var collection = _collectionEditor.Snapshot();

            using (TemporaryPrice.Clear(cardUnknownPrice))
            {
                var transformed = _transformation.Transform(deck, collection);

                Assert.That(transformed.MainDeck.Count.ContainsKey(cardKnownPrice.Id));
                Assert.That(transformed.MainDeck.Count[cardKnownPrice.Id], Is.EqualTo(count));
                Assert.That(transformed.MainDeck.Count.ContainsKey(cardUnknownPrice.Id), Is.False);
            }
        }
Ejemplo n.º 4
0
        public void Price_can_be_temporarily_cleared()
        {
            const string name = "plains";
            var          card = _repo.CardsByName[name][1];

            using (TemporaryPrice.Clear(card))
                Assert.That(card.PriceMid, Is.Null);

            Assert.That(card.PriceMid, Is.Not.Null);
        }
Ejemplo n.º 5
0
        public void Price_can_be_temporarily_cleared()
        {
            var card = _repo.CardsByName["plains"][1];

            using (TemporaryPrice.Set(card, 1f))
            {
                Assert.That(card.Price, Is.Not.Null);
                using (TemporaryPrice.Clear(card))
                    Assert.That(card.Price, Is.Null);
            }
        }
Ejemplo n.º 6
0
        public void Known_price_is_preferred()
        {
            const string name  = "plains";
            const int    count = 1;

            var cardKnownPrice   = _repo.CardsByName[name][0];
            var cardUnknownPrice = _repo.CardsByName[name][1];

            _deckEditor.Add(cardUnknownPrice, count);

            var deck       = _deckEditor.Snapshot();
            var collection = _collectionEditor.Snapshot();

            using (TemporaryPrice.Clear(cardUnknownPrice))
            {
                var transformed = _transformation.Transform(deck, collection);

                Assert.That(transformed.MainDeck.Count[cardKnownPrice.Id], Is.EqualTo(count));
                Assert.That(transformed.MainDeck.Count.ContainsKey(cardUnknownPrice.Id), Is.False);
            }
        }
Ejemplo n.º 7
0
        public void Collected_is_preferred_over_Known_price()
        {
            const string name = "plains";

            var cardKnownPrice            = _repo.CardsByName[name][0];
            var cardCollectedUnknownPrice = _repo.CardsByName[name][1];

            _collectionEditor.Add(cardCollectedUnknownPrice, 1);
            _deckEditor.Add(cardKnownPrice, 3);

            var deck       = _deckEditor.Snapshot();
            var collection = _collectionEditor.Snapshot();

            using (TemporaryPrice.Clear(cardCollectedUnknownPrice))
            {
                var transformed = _transformation.Transform(deck, collection);

                Assert.That(transformed.MainDeck.Count[cardKnownPrice.Id], Is.EqualTo(2));
                Assert.That(transformed.MainDeck.Count[cardCollectedUnknownPrice.Id], Is.EqualTo(1));
            }
        }