public void SetUp() { binder = (StandardModelBinder)StandardModelBinder.Basic(); context = new InMemoryBindingContext(); result = null; }
public void BindPropertyWith(IPropertyBinder binder, Expression <Func <T, object> > property, string rawValue = null) { if (rawValue != null) { Data(property, rawValue); } var prop = property.ToAccessor().InnerProperty; _actions.Add(context => StandardModelBinder.PopulatePropertyWithBinder(prop, context, binder)); }
public void SetUp() { using (var writer = new StreamWriter("flatfile.txt")) { writer.WriteLine("A|B|C|D"); writer.WriteLine("a0|b0|c0|d0"); writer.WriteLine("a1|b1|c1|d1"); writer.WriteLine("a2|b2|c2|d2"); } reader = new FlatFileReader <FlatFileReaderTarget>(StandardModelBinder.Basic(), new StubServiceLocator()); }
public void should_log_model_binder_usage() { var theModelBinder = StandardModelBinder.Basic(); MockFor <IModelBinderCache>() .Expect(c => c.BinderFor(typeof(SimpleModel))) .Return(theModelBinder); MockFor <IDebugReport>() .Expect(r => r.AddBindingDetail(new ModelBinderSelection { BinderType = typeof(StandardModelBinder), ModelType = typeof(SimpleModel) })); ClassUnderTest.ChoseModelBinder(typeof(SimpleModel), theModelBinder); VerifyCallsFor <IDebugReport>(); }
public void SetUp() { theBinder = new StandardModelBinder(new BindingRegistry(), new TypeDescriptorCache()); theRequestData = new RequestData(); var otherDictionary = new Dictionary <string, string>(); for (int i = 0; i < 10; i++) { otherDictionary.Add("Part" + i, Guid.NewGuid().ToString()); } theRequestData.AddValues(RequestDataSource.Request, new DictionaryKeyValues(otherDictionary)); theRouteValues = new Dictionary <string, string>(); theRequestData.AddValues(RequestDataSource.Route.ToString(), new DictionaryKeyValues(theRouteValues)); }
public void SetUp() { theBinder = StandardModelBinder.Basic().As <StandardModelBinder>(); theAggregateDictionary = new AggregateDictionary(); var otherDictionary = new Dictionary <string, object>(); for (int i = 0; i < 10; i++) { otherDictionary.Add("Part" + i, Guid.NewGuid().ToString()); } theAggregateDictionary.AddDictionary(RequestDataSource.Request.ToString(), otherDictionary); theRouteValues = new Dictionary <string, object>(); theAggregateDictionary.AddDictionary(RequestDataSource.Route.ToString(), theRouteValues); }
public void SetUp() { var theHttpRequest = MockRepository.GenerateMock <ICurrentChain>(); theHttpRequest.Stub(x => x.ResourceHash()).Return("something/else"); var locator = new StructureMapServiceLocator(new Container(x => { x.For <ICurrentChain>().Use(theHttpRequest); })); FubuApplication.SetupNamingStrategyForHttpHeaders(); var data = new InMemoryRequestData(); data["If-None-Match"] = "12345"; var context = new BindingContext(data, locator, new NulloBindingLogger()); var binder = StandardModelBinder.Basic(); theEtagRequest = binder.Bind(typeof(ETaggedRequest), context).As <ETaggedRequest>(); }
public void BindPropertyWith(IPropertyBinder binder, Expression <Func <T, object> > property, string rawValue = null) { if (rawValue != null) { Data(property, rawValue); } var prop = property.ToAccessor().InnerProperty; _actions.Add(context => { if (Model == null) { Model = new T(); } context.ForObject(Model, () => { Logger.Chose(typeof(T), new PropertyModelBinderStandin()); StandardModelBinder.PopulatePropertyWithBinder(prop, context, binder); Logger.FinishedModel(); }); }); }
public ResourcePathBinder(StandardModelBinder binder) { _binder = binder; }
public void SetUp() { binder = new ReaderBinder(StandardModelBinder.Basic(), new StubServiceLocator()); }
public SetterBinder(StandardModelBinder binder, IBindingContext context) { _binder = binder; _context = context; }