FilterInfo

We found 10 examples in language CSharp for this search. You will see 24 fragments of code.

Other methods

        [Fact]
        public void ActionFilters_ReturnsEmptyArray_WhenFiltersIsEmpty()
        {
            // Arrange
            IEnumerable<FilterInfo> filters = CreateEmptyFilters();
            FilterGrouping product = CreateProductUnderTest(filters);

            // Act
            IActionFilter[] actionFilters = product.ActionFilters;
            
            // Assert
            Assert.NotNull(actionFilters);
            Assert.Equal(0, actionFilters.Length);
        }

        private static IEnumerable<FilterInfo> CreateEmptyFilters()
        {
            return new FilterInfo[0];
        }

        private static FilterGrouping CreateProductUnderTest(IEnumerable<FilterInfo> filters)
        {
            return new FilterGrouping(filters);
        }


        [Theory]
        [PropertyData("CompareTestData")]
        public void Compare(FilterInfo x, FilterInfo y, int expectedSign)
        {
            int result = FilterInfoComparer.Instance.Compare(x, y);

            Assert.Equal(expectedSign, Math.Sign(result));
        }

        [Obsolete]
        void AddFilters(FilterInfo filterInfo);
        [Obsolete]
        void IFilterProvider.AddFilters(FilterInfo filterInfo) {
            AddFilters(filterInfo);
        }

        [Obsolete]
        void AddFilters(FilterInfo filterInfo);
        [Obsolete]
        void IFilterProvider.AddFilters(FilterInfo filterInfo) {
            AddFilters(filterInfo);
        }

        [Obsolete]
        void AddFilters(FilterInfo filterInfo);
        [Obsolete]
        void IFilterProvider.AddFilters(FilterInfo filterInfo) {
            AddFilters(filterInfo);
        }


        [Theory]
        [PropertyData("CompareTestData")]
        public void Compare(FilterInfo x, FilterInfo y, int expectedSign)
        {
            int result = FilterInfoComparer.Instance.Compare(x, y);

            Assert.Equal(expectedSign, Math.Sign(result));
        }

        [Fact]
        public void Constructor_Default()
        {
            // Arrange + Act
            FilterInfo filterInfo = new FilterInfo();

            // Assert
            Assert.Empty(filterInfo.ActionFilters);
            Assert.Empty(filterInfo.AuthorizationFilters);
            Assert.Empty(filterInfo.ExceptionFilters);
            Assert.Empty(filterInfo.ResultFilters);
        }

        [Fact]
        public void Constructor_IteratesOverFiltersOnlyOnce()
        {
            // Arrange
            var filtersMock = new Mock<IEnumerable<Filter>>();
            filtersMock.Setup(f => f.GetEnumerator()).Returns(new List<Filter>().GetEnumerator());

            // Act
            FilterInfo filterInfo = new FilterInfo(filtersMock.Object);

            // Assert
            filtersMock.Verify(f => f.GetEnumerator(), Times.Once());
        }

        [Obsolete]
        void AddFilters(FilterInfo filterInfo);
        [Obsolete]
        void IFilterProvider.AddFilters(FilterInfo filterInfo) {
            AddFilters(filterInfo);
        }

        [Fact]
        public void NoFilterShouldReturnEverything()
        {
            TestFilter(new List<FilterInfo>(), 10);
        }

        [Fact]
        public void FilterWithMissingValueShouldBeAbleToRemoveAll_Exact_CaseInsensitive()
        {
            var filters = new List<FilterInfo>
            {
                new FilterInfo
                {
                    ColumnName = "DeviceID",
                    FilterType = FilterType.ExactMatchCaseInsensitive,
                    FilterValue = "DKFSLKFJDKKD"
                }
            };

            TestFilter(filters, 0);
        }

        [Fact]
        public void FilterWithMissingValueShouldBeAbleToRemoveAll_StartsWith_CaseSensitive()
        {
            var filters = new List<FilterInfo>
            {
                new FilterInfo
                {
                    ColumnName = "DeviceID",
                    FilterType = FilterType.StartsWithCaseSensitive,
                    FilterValue = "DKFSLKFJDKKD"
                }
            };

            TestFilter(filters, 0);
        }

        [Fact]
        public void FilterWithMissingValueShouldBeAbleToRemoveAll_StartsWith_CaseInsensitive()
        {
            var filters = new List<FilterInfo>
            {
                new FilterInfo
                {
                    ColumnName = "DeviceID",
                    FilterType = FilterType.StartsWithCaseInsensitive,
                    FilterValue = "DKFSLKFJDKKD"
                }
            };

            TestFilter(filters, 0);
        }

        [Fact]
        public void FilterWithMissingValueShouldBeAbleToRemoveAll_Contains_CaseSensitive()
        {
            var filters = new List<FilterInfo>
            {
                new FilterInfo
                {
                    ColumnName = "DeviceID",
                    FilterType = FilterType.ContainsCaseSensitive,
                    FilterValue = "DKFSLKFJDKKD"
                }
            };

            TestFilter(filters, 0);
        }

        [Fact]
        public void FilterWithMissingValueShouldBeAbleToRemoveAll_Contains_CaseInsensitive()
        {
            var filters = new List<FilterInfo>
            {
                new FilterInfo
                {
                    ColumnName = "DeviceID",
                    FilterType = FilterType.ContainsCaseInsensitive,
                    FilterValue = "DKFSLKFJDKKD"
                }
            };

            TestFilter(filters, 0);
        }

        [Fact]
        public void ActionFilters_ReturnsEmptyArray_WhenFiltersIsEmpty()
        {
            // Arrange
            IEnumerable<FilterInfo> filters = CreateEmptyFilters();
            FilterGrouping product = CreateProductUnderTest(filters);

            // Act
            IActionFilter[] actionFilters = product.ActionFilters;
            
            // Assert
            Assert.NotNull(actionFilters);
            Assert.Equal(0, actionFilters.Length);
        }

        private static IEnumerable<FilterInfo> CreateEmptyFilters()
        {
            return new FilterInfo[0];
        }

        private static FilterGrouping CreateProductUnderTest(IEnumerable<FilterInfo> filters)
        {
            return new FilterGrouping(filters);
        }

System.Management.Automation.FilterInfo : FunctionInfo

Methods :

public Boolean get_CmdletBinding()
public String get_DefaultParameterSet()
public String get_Definition()
public String get_Description()
public Void set_Description(String value = )
public String get_HelpFile()
public String get_Noun()
public ScopedItemOptions get_Options()
public Void set_Options(ScopedItemOptions value = )
public ReadOnlyCollection<PSTypeName> get_OutputType()
public ScriptBlock get_ScriptBlock()
public String get_Verb()
public CommandTypes get_CommandType()
public PSModuleInfo get_Module()
public String get_ModuleName()
public String get_Name()
public Dictionary<String, ParameterMetadata> get_Parameters()
public ReadOnlyCollection<CommandParameterSetInfo> get_ParameterSets()
public RemotingCapability get_RemotingCapability()
public String get_Source()
public Version get_Version()
public SessionStateEntryVisibility get_Visibility()
public Void set_Visibility(SessionStateEntryVisibility value = )
public ParameterMetadata ResolveParameter(String name = )
public String ToString()
public Type GetType()
public Boolean Equals(Object obj = )
public Int32 GetHashCode()