Ejemplo n.º 1
0
        public void ShouldReturnNotEnoughPointsErrorMessageForStaticPriceItem(Int32 quantity, Int32 initialPoints, Int32 expectedPointsNeeded)
        {
            var item = new StaticPriceItem();

            var player = new Player()
            {
                Points = initialPoints
            };

            Either <BuyResult, String> result = item.TryBuy(quantity, player);

            Assert.True(result.IsRight());
            Assert.Equal(String.Format(Item.NotEnoughPointsErrorMessage, expectedPointsNeeded, item.GetSpecificNameForNotEnoughToBuy(player)), result.Right());
        }
Ejemplo n.º 2
0
        public void ShouldReturnStaticPrice(Int32 quantity)
        {
            var item = new StaticPriceItem();

            var expectedPointsSpent = quantity * StaticPriceItem.StaticPrice;

            var player = new Player()
            {
                Points = expectedPointsSpent
            };

            Either <BuyResult, String> result = item.TryBuy(quantity, player);

            Assert.True(result.IsLeft());
            Assert.Equal(quantity, result.Left().QuantityPurchased);
            Assert.Equal(expectedPointsSpent, result.Left().PointsSpent);
        }