Example #1
0
        public void ShouldGetTotalWeight()
        {
            var fruit = new BaseFruit(2.5, 12, "someFruit", "black", 10);

            var actualPriceByWeight = fruit.GetTotalWeight();

            Assert.AreEqual(actualPriceByWeight, 30);
        }
Example #2
0
        public void ShouldGetGetPriceWithTax()
        {
            var fruit = new BaseFruit(2.5, 12, "someFruit", "black", 10);

            var actualTaxedPrice = fruit.GetPriceWithTax(2.5);

            Assert.AreEqual(35, actualTaxedPrice);
            Assert.That(actualTaxedPrice, Is.EqualTo(35));
        }
Example #3
0
        public void ShouldGetFruitsTaxedPriceByAmount()
        {
            var fruit = new BaseFruit(2.5, 12, "someFruit", "black", 10);

            var actualTaxedPrice = fruit.GetFruitsTaxedPriceByAmount(3.5);

            Assert.AreEqual(42, actualTaxedPrice);
            Assert.That(actualTaxedPrice, Is.EqualTo(42));
        }
        public void GetPriceWithTax_PriceAndTax()
        {
            double expected = 5.5;
            double actual;

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

            actual = baseFruitAmount.GetPriceWithTax(0.1);

            NUnit.Framework.Assert.AreEqual(expected, actual, $"Expected result is {0}, but actual result was {1}");
        }
        public void GetTotalWeight_AmountAndWeight()
        {
            double expected = 450;
            double actual;

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

            actual = baseFruitAmount.GetTotalWeight();

            NUnit.Framework.Assert.AreEqual(expected, actual, $"Expected result is {0}, but actual result was {1}");
        }
        public void GetFruitsTaxedPriceByAmount_PriceWithTaxAndAmount()
        {
            double expected = 550;
            double actual;

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

            actual = baseFruitAmount.GetFruitsTaxedPriceByAmount(5.5);

            NUnit.Framework.Assert.AreEqual(expected, actual, $"Expected result is {0}, but actual result was {1}");
        }
        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}");
        }
Example #8
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);
        }
Example #9
0
        public void ShouldGetAllFruitsWeights(double weightFruit1, double weightFruit2)
        {
            var fruit1  = new BaseFruit(weightFruit1, 20, "Plola", "orange", 34);
            var fruit2  = new BaseFruit(weightFruit2, 30, "Plola", "orange", 34);
            var mfruits = new List <BaseFruit>();

            mfruits.Add(fruit1);
            mfruits.Add(fruit2);
            var actualAmount = _storeActions.GetAllFruitsWeights(mfruits);

            Assert.That(actualAmount, Is.EqualTo(mfruits.Sum(x => x.Weight)));
        }
Example #10
0
        public void ShouldGetAllFruitsAmount(int amountFruit1, int amountFruit2)
        {
            var fruit1  = new BaseFruit(23.4, amountFruit1, "Plola", "orange", 34);
            var fruit2  = new BaseFruit(23.4, amountFruit2, "Plola", "orange", 34);
            var mfruits = new List <BaseFruit>();

            mfruits.Add(fruit1);
            mfruits.Add(fruit2);
            var actualAmount = _storeActions.GetAllFruitsAmount(mfruits);

            Assert.That(actualAmount, Is.EqualTo(mfruits.Sum(x => x.Amount)));
        }
        public void InitializeList()
        {
            _baseFruitsList.Add(new BasicStoreSet().Apple());
            _baseFruitsList.Add(new BasicStoreSet().Banana());
            _baseFruitsList.Add(new BasicStoreSet().Cherry());
            _baseFruitsList.Add(new BasicStoreSet().Orange());

            var fruit1  = new BaseFruit(12, 14, "Banan", "yellow", 20);
            var fruit2  = new BaseFruit(10, 16, "Apricot", "yellow", 25);
            var fruit3  = new BaseFruit(10, 16, "Apricot", "yellow", 25);
            var fruit4  = new BaseFruit(8, 10, "Apple", "green", 15);
            var fruit5  = new BaseFruit(10, 12, "Avokado", "green", 20);
            var fruit6  = new BaseFruit(8, 14, "Durian", "green", 15);
            var fruit7  = new BaseFruit(10, 18, "Noina", "green", 15);
            var fruit8  = new BaseFruit(8, 15, "AppleGreen", "green", 15);
            var fruit9  = new BaseFruit(12, 11, "Apple", "red", 15);
            var fruit10 = new BaseFruit(10, 11, "Cherry", "red", 20);
            var fruit11 = new BaseFruit(12, 11, "Sala", "blue", 15);
            var fruit12 = new BaseFruit(10, 11, "Carambola", "blue", 25);
            var fruit13 = new BaseFruit(12, 11, "Orange", "blue", 15);
            var fruit14 = new BaseFruit(15, 11, "Carrot", "blue", 35);

            _fruitsList.Add(fruit1);
            _fruitsList.Add(fruit2);
            _fruitsList.Add(fruit3);
            _fruitsList.Add(fruit4);
            _fruitsList.Add(fruit5);
            _fruitsList.Add(fruit6);
            _fruitsList.Add(fruit7);
            _fruitsList.Add(fruit8);
            _fruitsList.Add(fruit9);
            _fruitsList.Add(fruit10);
            _fruitsList.Add(fruit11);
            _fruitsList.Add(fruit12);
            _fruitsList.Add(fruit13);
            _fruitsList.Add(fruit14);
        }
        public void GetFruitsPriceByWeight_WeightAndPrice_LessThanZeroWeight()
        {
            BaseFruit baseFruitWeight = new BaseFruit(-4.5, 100, "carrot", "orange", 5);

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

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