public void HappyPath() { var query = Substitute.For <IQuery <string> >(); var queryPerformer = Substitute.For <IQueryPerformer <IQuery <string>, string> >(); queryPerformer.Perform(query).Returns("Succes"); var queryBus = new QueryBus(t => queryPerformer); var queryResult = queryBus.Perform(query); Assert.Equal("Succes", queryResult); }
public void TypeCheck() { var query = new TestQuery(); var queryPerformer = new TestQueryPerformer("Whatever"); Type requestedType = typeof(void); var queryBus = new QueryBus(t => { requestedType = t; return(queryPerformer); }); queryBus.Perform(query); Assert.Equal(typeof(IQueryPerformer <TestQuery, string>), requestedType); }