public void SetUp() { streamingData = new InMemoryStreamingData(); writer = new InMemoryOutputWriter(); theFormatter = new XmlFormatter(streamingData, writer); }
public void the_resulting_feed_does_manage_to_write_some_xml() { var outputWriter = new InMemoryOutputWriter(); theWriter.Write(outputWriter); outputWriter.ContentType.ShouldEqual(new FeedWithExtension().ContentType); outputWriter.ToString().ShouldContain("<Item xmlns=\"\"><City>Dallas</City><Name>The second item</Name></Item>"); }
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() { theUrls = new ValidStubUrlRegistry(); output = new InMemoryOutputWriter(); theWriter = new FeedWriter <FeedTarget>( new FeedWithExtension(), new FeedTargetLinks(), theUrls, output); theResultingFeed = theWriter.BuildFeed(new FeedTargetSource()); }
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); }
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(); }
protected override void beforeEach() { theDescription = new Description { Title = "Test" }; theTag = new HtmlTag("div"); theWriter = new InMemoryOutputWriter(); Services.Inject <IOutputWriter>(theWriter); MockFor <IVisualizer>().Stub(x => x.VisualizeDescription(theDescription, ellided: false)).Return(theTag); ClassUnderTest.Write(MimeType.Html.Value, theDescription); }
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); }
protected override void beforeEach() { theOutput = new ParentType { Name = "Josh", Child = new ComplexType { Key = "Test", Value = "Value" } }; theJson = "Hello"; theOutputWriter = new InMemoryOutputWriter(); Services.Inject <IOutputWriter>(theOutputWriter); MockFor <IJsonSerializer>().Stub(x => x.Serialize(theOutput)).Return(theJson); ClassUnderTest.Write(theOutput, MimeType.Json.ToString()); }
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); }