public void CalculateMaxTotalForCollectionType()
        {
            testCollection = new List <Order>
            {
                new Order
                {
                    OrderId = 1,
                    Name    = "Raul",
                    Price   = 26.7,
                    Sex     = "M"
                },

                new Order
                {
                    OrderId = 2,
                    Name    = "Stephan",
                    Price   = 25.4,
                    Sex     = "M"
                },
                new Order
                {
                    OrderId = 3,
                    Name    = "Maria",
                    Price   = 76.2,
                    Sex     = "F"
                }
            };
            var actualMaxTotal = sut.CalculateTotalFromCollection(testCollection);

            //assert
            Assert.That(actualMaxTotal.Equals(128.3));
        }
Example #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");
        }