public void ProvideForActionFilter_OneDescriptorProviderThatReturn1AuthProvider_Instance_ReturnsEmptySet() { _descProvider.Descriptors.Add(FilterDescriptor.NewIncludeInstance(new FakeAuthFilter(), 1)); var filters = GetFilters <IActionFilter>(_filterProviderWith1DescProvider); filters.Should().NotBeNull(); filters.Should().BeEmpty(); }
public void ProvideForAuthFilter_OneWithFilterAndMatchingSkip_Instance_ReturnsEmptySet() { _descProvider.Descriptors.Add(FilterDescriptor.NewIncludeInstance(new FakeAuthFilter(), 1)); _descProvider.Descriptors.Add(FilterDescriptor.NewSkip(typeof(FakeAuthFilter))); var filters = GetFilters <IAuthorizationFilter>(_filterProviderWith1DescProvider); filters.Should().NotBeNull(); filters.Should().BeEmpty(); }
public void ProvideForAuthFilter_MultipleFiltersWithOneMatchingSkip_Instance_ReturnsNonSkippedFilters() { _descProvider.Descriptors.Add(FilterDescriptor.NewIncludeInstance(new FakeAuthFilter(), 1)); _descProvider.Descriptors.Add(FilterDescriptor.NewIncludeInstance(new FakeAuthFilter2(), 2)); _descProvider.Descriptors.Add(FilterDescriptor.NewSkip(typeof(FakeAuthFilter))); var filters = GetFilters <IAuthorizationFilter>(_filterProviderWith1DescProvider); filters.Should().NotBeNull(); filters.Should().HaveCount(1); filters.ElementAt(0).Should().BeOfType <FakeAuthFilter2>(); }
public void ProvideForAuthFilter_Ordering_Instance_ReturnsCorrectOrdering() { _descProvider.Descriptors.Add(FilterDescriptor.NewIncludeInstance(new FakeAuthFilter2(), 2)); _descProvider.Descriptors.Add(FilterDescriptor.NewIncludeInstance(new FakeAuthFilter(), 1)); var filters = GetFilters <IAuthorizationFilter>(_filterProviderWith1DescProvider); filters.Should().NotBeNull(); filters.Should().HaveCount(2); filters.ElementAt(0).Should().BeOfType <FakeAuthFilter>(); filters.ElementAt(1).Should().BeOfType <FakeAuthFilter2>(); }