コード例 #1
0
		public void WriteTo ()
		{
			var doc = new InlineCategoriesDocument ();
			var f = new AtomPub10CategoriesDocumentFormatter (doc);
			doc.Scheme = "http";
			doc.IsFixed = false;
			var sw = new StringWriter ();
			using (var xw = XmlWriter.Create (sw, settings))
				f.WriteTo (xw);
			Assert.AreEqual (app1, sw.ToString ());
		}
コード例 #2
0
        public override void WriteToStream(Type type, object value, Stream writeStream, HttpContent content) {

            var document = value as IPublicationCategoriesDocument;

            var atomDoc = new InlineCategoriesDocument(
                document.Categories.Select(c => new SyndicationCategory(c.Name) { Label = c.Label }),
                document.IsFixed,
                document.Scheme
            );

            var formatter = new AtomPub10CategoriesDocumentFormatter(atomDoc);

            using (writeStream) {
                using (var writer = XmlWriter.Create(writeStream)) {
                    formatter.WriteTo(writer);
                }
            }
        }
コード例 #3
0
		public void WriteTo2 ()
		{
			var doc = new InlineCategoriesDocument ();
			var f = new AtomPub10CategoriesDocumentFormatter (doc);
			doc.Categories.Add (new SyndicationCategory ("TEST CATEGORY"));
			var sw = new StringWriter ();
			using (var xw = XmlWriter.Create (sw, settings))
				f.WriteTo (xw);
			Assert.AreEqual (app2, sw.ToString ());
		}