Esempio n. 1
0
        public void CalculateMostExpensiveGenderForCollectionType()
        {
            testCollection = new List <Order>
            {
                new Order
                {
                    OrderId = 1,
                    Name    = "Raul",
                    Price   = 26.7,
                    Sex     = "M"
                },

                new Order
                {
                    OrderId = 2,
                    Name    = "Jane",
                    Price   = 25.4,
                    Sex     = "F"
                },
                new Order
                {
                    OrderId = 3,
                    Name    = "Maria",
                    Price   = 76.2,
                    Sex     = "F"
                }
            };
            var actualMostExpensiveGender = sut.CalculateMostExpensiveGenderFromCollection(testCollection);

            //assert
            Assert.That(actualMostExpensiveGender.Equals("F"));
        }
Esempio n. 2
0
        public string CalculateAll <T>(T collection) where T : IEnumerable <Order>
        {
            var maxPrice            = maxPriceCalculator.CalculateMaxPriceFromCollection(collection);
            var mostExpensiveGender = mostExpensiveGenderCalculator.CalculateMostExpensiveGenderFromCollection(collection);
            var orderTotal          = maxTotalCalculator.CalculateTotalFromCollection(collection);

            return($"Max Price: {maxPrice}\n" +
                   $"Most Expensive Gender: {mostExpensiveGender}\n" +
                   $"Total of all Orders: {orderTotal}\n");
        }