public void CalculateMaxPriceForCollectionType() { 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 actualMaxPrice = sut.CalculateMaxPriceFromCollection(testCollection); //assert Assert.That(actualMaxPrice.Equals(76.2)); }
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"); }