public void NullPredicate() { var entity = new DummyEntity(); new TestCaseRunner() .Run(() => PredicateMiddleware <DummyContext, DummyEntity> .NullPredicate(entity)) .Verify(true, (Type)null); }
public async Task Usage_IMiddleware() { var middlewares = new PredicateMiddleware <Uri, FileInfo>[] { new HttpsPredicate(), new StaticFilePredicate(), }; Func <Uri, Task <PredicateFunc <FileInfo> > > pipeline = FilterPipeline.Build(middlewares.Select(x => x.ToDelegate())); var predicate = await pipeline(new Uri("https://example.com/foo")); Assert.AreEqual(true, predicate(new FileInfo("foo.html"))); Assert.AreEqual(false, predicate(new FileInfo("bar.html"))); Assert.AreEqual(false, (await pipeline(new Uri("http://example.com/foo")))(new FileInfo("foo.html"))); }