Ejemplo n.º 1
0
    public void CalculateTotalPotionPoints_Test()
    {
        // ARRANGE
        var pointCalculator = new ItemCalculator();
        var playerHp        = 100;
        var potionPoints    = 20;
        var expectedPoints  = (100 + 20);

        // ACT
        var points = pointCalculator.CalculateTotalPoints(playerHp, potionPoints);

        // ASSERT
        Assert.That(points, Is.EqualTo(expectedPoints));
    }
Ejemplo n.º 2
0
        public void Exception_On_Calculate_With_Null()
        {
            var menu = new List <Item>();

            menu.Add(new Item {
                Name = "Cola", Price = (decimal)0.5, Category = ItemCategory.Drink, Temperature = ItemTemperature.Cold
            });
            menu.Add(new Item {
                Name = "Coffee", Price = (decimal)1, Category = ItemCategory.Drink, Temperature = ItemTemperature.Hot
            });
            menu.Add(new Item {
                Name = "Cheese Sandwich", Price = (decimal)2, Category = ItemCategory.Food, Temperature = ItemTemperature.Cold
            });
            menu.Add(new Item {
                Name = "Steak Sandwich", Price = (decimal)4.5, Category = ItemCategory.Food, Temperature = ItemTemperature.Hot
            });

            var sut = new ItemCalculator(menu);

            ArgumentNullException ex = Assert.Throws <ArgumentNullException>(() => sut.Calculate(null));

            Assert.Equal("order", ex.ParamName);
        }
Ejemplo n.º 3
0
        public void Order_Value_Is_Correct(string[] order, decimal expectedValue)
        {
            var menu = new List <Item>();

            menu.Add(new Item {
                Name = "Cola", Price = (decimal)0.5, Category = ItemCategory.Drink, Temperature = ItemTemperature.Cold
            });
            menu.Add(new Item {
                Name = "Coffee", Price = (decimal)1, Category = ItemCategory.Drink, Temperature = ItemTemperature.Hot
            });
            menu.Add(new Item {
                Name = "Cheese Sandwich", Price = (decimal)2, Category = ItemCategory.Food, Temperature = ItemTemperature.Cold
            });
            menu.Add(new Item {
                Name = "Steak Sandwich", Price = (decimal)4.5, Category = ItemCategory.Food, Temperature = ItemTemperature.Hot
            });

            var sut = new ItemCalculator(menu);

            var result = sut.Calculate(order);

            Assert.Equal(expectedValue, result);
        }