public DispatcherTests() { Events = Substitute.For <IEventStore>(); Services = Substitute.For <IServiceProvider>(); Services.GetService(typeof(Domains.Airline.FlightReservation)).Returns(new Domains.Airline.FlightReservation()); var resv = new AggregateModel(typeof(Domains.Airline.FlightReservation)); resv.SetFactoryHandler("Create"); resv.AddCommandHandler("Cancel"); Dispatcher = new Dispatcher(new BoundedContextModel(new[] { resv }), Events, Services); }
public AggregateModelTests() { Model = new AggregateModel(typeof(Domains.Airline.FlightReservation)); Model.SetFactoryHandler(new CommandHandlerModel(Model.Type.GetMethods().Single(c => c.Name == "Create"))); Model.AddCommandHandler(new CommandHandlerModel(Model.Type.GetMethods().Single(c => c.Name == "Cancel"))); }
public AggregateModelBuilder <T> CreatedBy <TCommand>() { _model.SetFactoryHandler(new CommandHandlerModel(FindMethodByParameter(typeof(TCommand)))); return(this); }