Ejemplo n.º 1
0
        public void AddService_Should_Throw_When_FilterType_Is_Not_A_Filter()
        {
            // Act
            var collection = new CommandFilterCollection();

            // Arrange + Assert
            Assert.Throws <ArgumentException>(() =>
            {
                collection.AddService(typeof(string));
            });
        }
Ejemplo n.º 2
0
        public void AddService_Should_Add_ServiceCommandFilterFactory_Of_Specified_Type(Type filterType)
        {
            // Act
            var collection     = new CommandFilterCollection();
            var expectedFilter = new ServiceCommandFilterFactory(filterType);

            // Arrange
            var filter = collection.AddService(filterType, 0);

            // Assert
            Assert.NotNull(filter);
            Assert.NotEmpty(collection);
            Assert.Contains(filter, collection);
            Assert.IsType(expectedFilter.GetType(), filter);
        }