Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        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));
        }