protected override void configureObject(ObjectDef def) { def.Child(new ViewPath { ViewName = _viewName }); }
public void build_an_object_with_dependencies() { var request = new InMemoryFubuRequest(); var def = new ObjectDef(typeof(FakeJsonBehavior)); def.Child(typeof(IFubuRequest), request); var jsonWriter = def.Child(typeof(IJsonWriter), typeof(AjaxAwareJsonWriter)); jsonWriter.Child(typeof(IOutputWriter), typeof(HttpResponseOutputWriter)); jsonWriter.Child(typeof(IRequestData), typeof(InMemoryRequestData)); def.Child(typeof(IRequestData), typeof(InMemoryRequestData)); var container = new Container(x => { x.For <IActionBehavior>().Use(new ObjectDefInstance(def)); }); var jsonBehavior = container.GetInstance <IActionBehavior>().ShouldBeOfType <FakeJsonBehavior>(); jsonBehavior.Writer.ShouldBeOfType <AjaxAwareJsonWriter>(); jsonBehavior.Request.ShouldBeTheSameAs(request); }
protected override void configureObject(ObjectDef def) { ObjectDef currentCandidate = null; foreach (var pair in _outputs.Reverse()) { var candidate = new ObjectDef(typeof(ConditionalOutput)); candidate.Child(typeof(Func<OutputFormatDetector, bool>), pair.Predicate); candidate.Dependencies.Add(new ConfiguredDependency { Definition = pair.OutputNode.ToObjectDef(), DependencyType = typeof(IActionBehavior) }); if (currentCandidate != null) { candidate.Dependencies.Add(new ConfiguredDependency { Definition = currentCandidate, DependencyType = typeof(ConditionalOutput) }); } currentCandidate = candidate; } def.Dependencies.Add(new ConfiguredDependency { Definition = currentCandidate, DependencyType = typeof(ConditionalOutput) }); }
protected override void configureObject(ObjectDef def) { def.Child(_viewToken); def.Child(_actionCall); }
protected override void configureObject(ObjectDef def) { def.Child(MimeType); }