public void GetFilters_WithNullJob_ReturnsEmptyList() { // Arrange var provider = new JobFilterAttributeFilterProvider(); // Act var result = provider.GetFilters(null); // Assert Assert.Empty(result); }
public void GetFilters_IncludesAttributesOMethod() { // Arrange var job = Job.FromExpression(() => ClassWithActionAttribute.Method()); var provider = new JobFilterAttributeFilterProvider(); // Act var filter = provider.GetFilters(job).Single(); // Assert var attribute = filter.Instance as MyFilterAttribute; Assert.NotNull(attribute); Assert.Equal(JobFilterScope.Method, filter.Scope); Assert.Equal(1234, filter.Order); }
public void GetFilters_IncludesTypeAttributesFromDerivedTypeWhenMethodIsOnBaseClass() { // Arrange var job = Job.FromExpression<DerivedClass>(x => x.MyMethod()); var provider = new JobFilterAttributeFilterProvider(); // Act var filters = provider.GetFilters(job); // Assert Assert.NotNull(filters.Select(f => f.Instance).Cast<MyFilterAttribute>().Single()); }
public void GetFilters_RetrievesNonCachedAttributesWhenConfiguredNotTo() { // Arrange var job = Job.FromExpression<DerivedClass>(x => x.MyMethod()); var provider = new JobFilterAttributeFilterProvider(false); // Act var filters = provider.GetFilters(job); // Assert Assert.NotNull(filters.Select(f => f.Instance).Cast<MyFilterAttribute>().Single()); }