// Internal for unit testing purposes. internal static string BuildAllMessagesAsSingleMessage(ISayHelloFactory helloFactory, IEnumerable <ISayHelloLanguage> languageHellos, IEnumerable <ISayHello> allHellos, IEnglishHello englishHello, IFrenchHello frenchHello) { var sb = new StringBuilder(); sb.AppendLine("Here are all the results from the Say Hello injected classes"); sb.AppendLine(); sb.AppendLine($"The IEnglishHello says in {englishHello.Language} '{englishHello.GetHello()}'"); sb.AppendLine($"The IFrenchHello says in {frenchHello.Language} '{frenchHello.GetHello()}'"); sb.AppendLine(); sb.AppendLine("Here are all the results from the IEnumerable<ISayHelloLanguage> injected classes"); sb.AppendLine(); foreach (var langHello in languageHellos) { sb.AppendLine($"The {langHello.GetType().Name} says in {langHello.Language} '{langHello.GetHello()}'"); } sb.AppendLine(); sb.AppendLine("Here are all the results from the IEnumerable<ISayHello> injected classes\n"); foreach (var langHello in allHellos) { sb.AppendLine($"The {langHello.GetType().Name} says '{langHello.GetHello()}'"); } sb.AppendLine(); sb.AppendLine("Here are all the results from the ISayHelloFactory.GetSupportedLanguageHellos()"); sb.AppendLine(); foreach (var langHello in helloFactory.GetSupportedLanguageHellos()) { sb.AppendLine($"The {langHello.GetType().Name} says in {langHello.Language} '{langHello.GetHello()}'"); } sb.AppendLine(); sb.AppendLine("Here are all the results from the ISayHelloFactory.GetAllLanguageHellos()"); sb.AppendLine(); foreach (var langHello in helloFactory.GetAllLanguageHellos()) { sb.AppendLine($"The {langHello.GetType().Name} says in {langHello.Language} '{langHello.GetHello()}'"); } sb.AppendLine(); sb.AppendLine("Here are all the results from the ISayHelloFactory.GetAllHellos()"); sb.AppendLine(); foreach (var langHello in helloFactory.GetAllHellos()) { sb.AppendLine($"The {langHello.GetType().Name} says '{langHello.GetHello()}'"); } return(sb.ToString()); }
public HomeController(ISayHelloFactory helloFactory, IEnumerable <ISayHelloLanguage> languageHellos, IEnumerable <ISayHello> allHellos, IEnglishHello englishHello, IFrenchHello frenchHello) { _helloFactory = helloFactory; _languageHellos = languageHellos; _allHellos = allHellos; _englishHello = englishHello; _frenchHello = frenchHello; }
protected abstract string GetAllMessagesFromController(ISayHelloFactory helloFactory, IEnumerable <ISayHelloLanguage> languageHellos, IEnumerable <ISayHello> allHellos, IEnglishHello englishHello, IFrenchHello frenchHello);
protected override string GetAllMessagesFromController(ISayHelloFactory helloFactory, IEnumerable <ISayHelloLanguage> languageHellos, IEnumerable <ISayHello> allHellos, IEnglishHello englishHello, IFrenchHello frenchHello) { return(HomeController.BuildAllMessagesAsSingleMessage(helloFactory, languageHellos, allHellos, englishHello, frenchHello)); }