コード例 #1
0
        protected override void beforeEach()
        {
            output = new JsonOutput
            {
                Name = "Max",
                Age  = 6
            };

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

            mimeType  = null;
            rawOutput = null;

            MockFor <IOutputWriter>().Stub(x => x.Write(null, null)).IgnoreArguments().Do(
                new Action <string, string>((t, o) =>
            {
                mimeType  = t;
                rawOutput = o;
            }));

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

            ClassUnderTest.Write(output);
        }
コード例 #2
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);
        }
コード例 #3
0
 public void SetUp()
 {
     data = new InMemoryRequestData();
     detector = new DebugDetector(data);
 }
コード例 #4
0
 public void SetUp()
 {
     registry = new ValueConverterRegistry(new IConverterFamily[0]);
     data = new InMemoryRequestData();
     binder = new StandardModelBinder(registry, new TypeDescriptorRegistry());
     locator = MockRepository.GenerateMock<IServiceLocator>();
     result = null;
 }
コード例 #5
0
        public void SetUp()
        {
            request = new InMemoryRequestData();
            locator = MockRepository.GenerateMock<IServiceLocator>();

            context = new BindingContext(request, locator);
        }
コード例 #6
0
        public void SetUp()
        {
            var container = StructureMapContainerFacility.GetBasicFubuContainer();

            data = new InMemoryRequestData();
            container.Inject<IRequestData>(data);

            context = container.GetInstance<BindingContext>();
            holder = new HolderClass();

            data["SpecialName"] = "Jeremy";
            data["SpecialAge"] = "36";
            data["SpecialColor"] = "red";

            context.StartObject(holder);

            var property = ReflectionHelper.GetProperty<HolderClass>(x => x.HeldClass);

            context.BindChild(property, typeof(SpecialClassThatIsHeld), "Special");
        }
コード例 #7
0
        public void SetUp()
        {
            var container = StructureMapContainerFacility.GetBasicFubuContainer();

            data = new InMemoryRequestData();
            container.Inject<IRequestData>(data);

            context = container.GetInstance<BindingContext>();
            holder = new HolderClass();

            data["HeldClassName"] = "Jeremy";
            data["HeldClassAge"] = "NOT A NUMBER";

            context.StartObject(holder);

            var property = ReflectionHelper.GetProperty<HolderClass>(x => x.HeldClass);

            context.BindChild(property);
        }
コード例 #8
0
 private InMemoryBindingContext(InMemoryRequestData data, IContainer container)
     : base(data, new StructureMapServiceLocator(container))
 {
     _data = data;
     _container = container;
 }