コード例 #1
0
        public void SetUp()
        {
            theDictionary = new Dictionary <string, string>();
            theInnerData  = new InMemoryRequestData();

            theSubstitutedData = new SubstitutedRequestData(theInnerData, new DictionaryKeyValues(theDictionary));
        }
コード例 #2
0
        public void beforeEach()
        {
            theRawRequest = new InMemoryRequestData();

            var services = new InMemoryServiceLocator();

            services.Add <IObjectConverter>(new ObjectConverter());

            ClassUnderTest = new BindingContext(theRawRequest, services, new NulloBindingLogger());
        }
コード例 #3
0
        public void SetUp()
        {
            request = new InMemoryRequestData();
            locator = MockRepository.GenerateMock <IServiceLocator>();

            var smartRequest = MockRepository.GenerateMock <ISmartRequest>();

            locator.Stub(x => x.GetInstance <ISmartRequest>()).Return(smartRequest);

            context = new BindingContext(request, locator, new NulloBindingLogger());
        }
        public void SetUp()
        {
            requestData = new InMemoryRequestData();

            container = DatabaseDriver.GetFullFastPackContainer();
            container.Configure(x =>
            {
                x.UseOnDemandNHibernateTransactionBoundary();
                x.For <IRequestData>().Use(requestData);
            });
        }
        public void SetUp()
        {
            theDictionary = new Dictionary <string, string>();
            theInnerData  = new InMemoryRequestData();

            //inner / substitutions
            theSubstitutedData = new SubstitutedRequestData(theInnerData, new DictionaryKeyValues(theDictionary));

            theDictionary.Add("val", "value");
            theDictionary.Add("setting", "setting-{val}");
            theInnerData["Key"] = "*{setting}*";
        }
コード例 #6
0
        public void should_log_model_binder_selection()
        {
            var theModelBinder = MockFor <IModelBinder>();

            MockFor <IModelBinderCache>().Stub(x => x.BinderFor(typeof(Something)))
            .Return(theModelBinder);

            var data = new InMemoryRequestData();

            ClassUnderTest.BindModel(typeof(Something), data);

            MockFor <IBindingLogger>().AssertWasCalled(x => x.ChoseModelBinder(typeof(Something), theModelBinder));
        }
コード例 #7
0
        public void Setup()
        {
            var services = new InMemoryServiceLocator();
            var resolver = new ObjectResolver(services, new BindingRegistry(), new NulloBindingLogger());

            _request = new InMemoryRequestData();
            _logger  = MockRepository.GenerateMock <IBindingLogger>();
            _context = new BindingContext(_request, services, _logger);

            services.Add <IObjectResolver>(resolver);
            _request[ReflectionHelper.GetAccessor <ComplexClass>(x => x.Nested.Foo).Name] = "Bar";
            _fooProperty = ReflectionHelper.GetProperty <ComplexClass>(x => x.Nested.Foo);
            setup();
        }
コード例 #8
0
        protected override void beforeEach()
        {
            output = new JsonOutput
            {
                Name = "Max",
                Age  = 6
            };

            requestData = new InMemoryRequestData();
            Services.Inject <IRequestData>(requestData);

            theOutputWriter = new InMemoryOutputWriter();
            Services.Inject <IOutputWriter>(theOutputWriter);
        }
コード例 #9
0
        protected override void beforeEach()
        {
            output = new JsonOutput {
                Name = "Max",
                Age  = 6
            };

            requestData = new InMemoryRequestData();
            Services.Inject <IRequestData>(requestData);

            theOutputWriter = new InMemoryOutputWriter();
            Services.Inject <IOutputWriter>(theOutputWriter);

            requestData["X-Requested-With"] = "XMLHttpRequest";

            ClassUnderTest.Write(output);
        }
コード例 #10
0
        public void find_enumerable_request_data_from_parent()
        {
            var requestData = new InMemoryRequestData();

            requestData.ReadData(@"
Name=Jeremy
Age=38
List[0]Name=Max
List[0]Hometown=Austin
List[1]Name=Natalie
List[1]Hometown=Bentonville
List[2]Name=Nadine
List[2]Hometown=Jasper
List[3]Hometown=Montrose
");

            var elements = EnumerateFlatRequestData.For(requestData, "List");

            elements.Count().ShouldEqual(4);
            elements.Select(x => x.Value("Hometown"))
            .ShouldHaveTheSameElementsAs("Austin", "Bentonville", "Jasper", "Montrose");
        }
コード例 #11
0
        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>();
        }
コード例 #12
0
 public void SetUp()
 {
     data = new InMemoryRequestData();
     detector = new DebugDetector(data);
 }
コード例 #13
0
 public void SetUp()
 {
     _calledUpon = MockRepository.GenerateStub <ICalledUpon>();
     _data       = new InMemoryRequestData();
     _calledUpon.Stub(c => c.Action());
 }
コード例 #14
0
 public void SetUp()
 {
     theData         = new InMemoryRequestData();
     objectConverter = new ObjectConverter();
     theRequest      = new SmartRequest(theData, objectConverter);
 }