public void Setup() { _requestGraph = RequestGraph.Create(); _request = _requestGraph.GetHttpRequestMessage(); _descriptor = _requestGraph.GetActionDescriptor(); _response = new HttpResponseMessage(); _invoker = Substitute.For <IBehaviorChainInvoker>(); _messageHandler = new ActionMessageHandler(_descriptor, _invoker, new Metrics(), new Configuration()); }
protected override void given_the_context_of() { _target = new object(); _host = Mock<IActionHost>(); var filterManager = Stub<IFilterManager>(); filterManager.Stub(x => x.HandlerAware) .Return(new IHandlerAware[]{}) .Repeat.Any(); _host.Stub(x => x.Filters) .Return(filterManager) .Repeat.Any(); _host.Stub(x => x.Actions) .Return(new List<IAction>()) .Repeat.Any(); _handler = new ActionMessageHandler(_host, _target); }
protected override void given_the_context_of() { target = new object(); host = Mock <IActionHost>(); var filterManager = Stub <IFilterManager>(); filterManager.Stub(x => x.HandlerAware) .Return(new IHandlerAware[] {}) .Repeat.Any(); host.Stub(x => x.Filters) .Return(filterManager) .Repeat.Any(); host.Stub(x => x.Actions) .Return(new List <IAction>()) .Repeat.Any(); handler = new ActionMessageHandler(host, target); }
static void Main() { SetupNLog(); ProjectBootStrapper projectBootstrapper; if (InitUsingBootstrappers(out projectBootstrapper) == false) return; CompositeRoot.Init(BuildContainer()); var form = CompositeRoot.Instance.GetDesignForm(); DebugDebugMessageHandler = CompositeRoot.Instance.GetDebugMessageHandler(); ActionMessageHandler = CompositeRoot.Instance.GetActionMessageHandler(); // Register Reports Base Folder var extension = new CustomRootDirectoryStorageExtension(ProjectReportPath); ReportStorageExtension.RegisterExtensionGlobal(extension); DevExpress.Skins.SkinManager.EnableFormSkinsIfNotVista(); //Here we specify the skin to use by its name Application.Run(form); }
public void Should_do_everything() { //TODO: rewrite as spec or individual unit tests! // given infrastructure DataSourceSetter setter; IDesignDataRepository datarep; var dataDefRep = init(out setter, out datarep); var handler = new ActionMessageHandler(setter, new EventAggregator(), dataDefRep, new ReportControllerFactory()); // given a report var report = new XtraReportWithSubReportInDetailReport(); // given the parent has a datasource IReportDatasourceMetadata metadata = datarep.GetAvailableMetadatas().Single(a => a.UniqueId == "DogTime"); setter.SetReportDatasource(report, metadata); // given a subreport in parent report var newSubReport = new XtraReport(); var band = (DetailReportBand)report.Bands[BandKind.DetailReport]; var myContainer = (XRSubreport)band.Bands[BandKind.Detail].Controls[0]; // when handling a message var message = new ReportActivatedBySubreportMessage(newSubReport, myContainer); handler.Handle(message); // then: newSubReport.DataSource.Should().NotBeNull(); var dog = (Dog)((List<object>)newSubReport.DataSource).Single(); var peoples = (List<Person2>)report.DataSource; peoples[0].Dogs[0].Name.Should().Be(dog.Name); }
public void GivenTheDesignRuntimeIsReady() { _eventAggregator = new EventAggregator(); _dataContext = Factory.CreateForDogTime(out _setter); _messageHandler = new ActionMessageHandler(_setter, _eventAggregator, _dataContext.DesignDataDefinitionRepository, new ReportControllerFactory()); }