public void GetFruitsPriceByWeight_WeightAndPrice()
        {
            double expected = 22.5;
            double actual;

            BaseFruit baseFruitWeight = new BaseFruit(4.5, 100, "carrot", "orange", 5);

            actual = baseFruitWeight.GetFruitsPriceByWeight();

            NUnit.Framework.Assert.AreEqual(expected, actual, $"Expected result is {0}, but actual result was {1}");
        }
Esempio n. 2
0
        public void ShouldGetFruitsPriceByWeight()
        {
            var fruit = new BaseFruit(2.5, 12, "someFruit", "black", 10);

            var actualPriceByWeight = fruit.GetFruitsPriceByWeight();

            Assert.That(actualPriceByWeight, Is.EqualTo(25));
            Assert.That(actualPriceByWeight, Is.LessThanOrEqualTo(25));

            Assert.AreEqual(actualPriceByWeight, 25);
        }
        public void GetFruitsPriceByWeight_WeightAndPrice_LessThanZeroWeight()
        {
            BaseFruit baseFruitWeight = new BaseFruit(-4.5, 100, "carrot", "orange", 5);

            baseFruitWeight.GetFruitsPriceByWeight();
        }
Esempio n. 4
0
        public void ShouldGetFruitsPriceByWeight_ThrowsPriceException()
        {
            var fruit = new BaseFruit(2.5, 12, "someFruit", "black", -10);

            Assert.Throws <ArgumentOutOfRangeException>(() => fruit.GetFruitsPriceByWeight());
        }