Ejemplo n.º 1
0
        public void RemoveType_RemovesAllOfType()
        {
            // Arrange
            var collection = new FormatterCollection <IOutputFormatter>
            {
                new TestOutputFormatter(),
                new AnotherTestOutputFormatter(),
                new TestOutputFormatter()
            };

            // Act
            collection.RemoveType <TestOutputFormatter>();

            // Assert
            var formatter = Assert.Single(collection);

            Assert.IsType <AnotherTestOutputFormatter>(formatter);
        }
        public void NonGenericRemoveType_RemovesAllOfType()
        {
            // Arrange
            var collection = new FormatterCollection <IOutputFormatter>
            {
                new TestOutputFormatter(),
                new AnotherTestOutputFormatter(),
                new TestOutputFormatter()
            };

            // Act
            collection.RemoveType(typeof(TestOutputFormatter));

            // Assert
            var formatter = Assert.Single(collection);

            Assert.IsType(typeof(AnotherTestOutputFormatter), formatter);
        }