private static IServiceCollection AddFormatterManager(this IServiceCollection services) { IFormatterManager formatterManager = new FormatterManager(); formatterManager.RegisterFormatter("json", new JsonReportFormatter()); formatterManager.RegisterFormatter("xml", new XmlReportFormatter()); return(services.AddSingleton(formatterManager)); }
public void RegisterFormatterTest_ThrowsException(IDictionary <string, IReportFormatter> storage, string name, IReportFormatter formatter, Type expectedException) { // Arrange var manager = new FormatterManager(storage); // Act void TestAction() => manager.RegisterFormatter(name, formatter); // Assert Assert.That(TestAction, Throws.TypeOf(expectedException)); }