Example #1
0
        public void SetUp()
        {
            streamingData = new InMemoryStreamingData();
            writer = new InMemoryOutputWriter();

            theFormatter = new XmlFormatter(streamingData, writer);
        }
 public void SetUp()
 {
     ClassUnderTest = new JsonSerializer();
     theFubuRequestContext = MockRepository.GenerateMock<IFubuRequestContext>();
     theHttpRequest = MockRepository.GenerateMock<IHttpRequest>();
     theOutputWriter = new InMemoryOutputWriter();
     theFubuRequestContext.Stub(x => x.Request).Return(theHttpRequest);
     theFubuRequestContext.Stub(x => x.Writer).Return(theOutputWriter);
 }
        public void SetUp()
        {
            theRequest = OwinHttpRequest.ForTesting();
            writer = new InMemoryOutputWriter();

            var container = new Container(x => {
                x.For<IHttpRequest>().Use(theRequest);
                x.For<IOutputWriter>().Use(writer);
                x.For<IFubuRequest>().Use(new InMemoryFubuRequest());
            });

            context = new MockedFubuRequestContext(container);

            theFormatter = new XmlFormatter();
        }
        public void SetUp()
        {
            var projection = new Projection<Address>(DisplayFormatting.RawValues);
            projection.Value(x => x.Address1);
            projection.Value(x => x.Address2);
            projection.Value(x => x.City);
            projection.Value(x => x.StateOrProvince).Name("State");

            theXmlMediaOptions = new XmlMediaOptions(){
                Root = "Address"
            };
            theDocument = new XmlMediaDocument(theXmlMediaOptions);

            var urls = new StubUrlRegistry();

            var linkSource = new LinksSource<Address>();
            linkSource.ToSubject().Rel("self");
            linkSource.To(a => new AddressAction("change")).Rel("change");
            linkSource.To(a => new AddressAction("delete")).Rel("delete");

            theOutput = new InMemoryOutputWriter();

            var media = new MediaWriter<Address>(theDocument, linkSource, urls, projection, null, theOutput);


            theAddress = new Address(){
                Address1 = "22 Cherry Lane",
                Address2 = "Apt A",
                City = "Austin",
                StateOrProvince = "Texas"
            };



            media.Write("text/plain", theAddress);

            Debug.WriteLine(theOutput);
        }