当前位置: 首页>>代码示例>>C#>>正文


C# XDoc.ToCompactString方法代码示例

本文整理汇总了C#中XDoc.ToCompactString方法的典型用法代码示例。如果您正苦于以下问题:C# XDoc.ToCompactString方法的具体用法?C# XDoc.ToCompactString怎么用?C# XDoc.ToCompactString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XDoc的用法示例。


在下文中一共展示了XDoc.ToCompactString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Can_list_directory

 public void Can_list_directory()
 {
     var doc = new XDoc("files").Elem("x", StringUtil.CreateAlphaNumericKey(10));
     _s3ClientMock.Setup(x => x.GetDataInfo(_storageRoot + "/foo/bar/", false)).Returns(new AmazonS3DataInfo(doc)).AtMostOnce().Verifiable();
     var response = _mockService.CallStorage(storage =>
        storage.At("foo", "bar").WithTrailingSlash().Get(new Result<DreamMessage>())
     );
     Assert.IsTrue(response.IsSuccessful);
     Assert.AreEqual(doc.ToCompactString(), response.ToDocument().ToCompactString());
     _s3ClientMock.VerifyAll();
 }
开发者ID:maximmass,项目名称:DReAM,代码行数:11,代码来源:AmazonS3PublicStorageTests.cs

示例2: Can_use_xdoc_as_feature_return_type

 public void Can_use_xdoc_as_feature_return_type()
 {
     var msg = new XDoc("doc").Elem("woot", "true");
     var response = _plug.At("xdoc").Post(msg);
     Assert.AreEqual(msg.ToCompactString(), response.ToDocument().ToCompactString());
 }
开发者ID:aaronmars,项目名称:DReAM,代码行数:6,代码来源:DreamFeatureTests.cs

示例3: AssertFeature

 private void AssertFeature(string pattern, Result<DreamMessage> result, XDoc expected)
 {
     var feature = _blueprint[string.Format("features/feature[pattern='{0}']", pattern)];
     Assert.IsTrue(feature.Any(), string.Format("service doesn't have a feature for {0}", pattern));
     var doc = new XDoc("response").Elem("method", feature["method"].AsText);
     if(expected != null) {
         doc.Add(expected);
     }
     var response = result.Wait();
     Assert.IsTrue(response.IsSuccessful, response.GetErrorString());
     Assert.AreEqual(doc.ToCompactString(), response.ToDocument().ToCompactString());
 }
开发者ID:aaronmars,项目名称:DReAM,代码行数:12,代码来源:DreamFeatureTests.cs

示例4: XmlNullChar_in_xml_element_ToCompactString

 public void XmlNullChar_in_xml_element_ToCompactString()
 {
     var doc = new XDoc("root").Value("foo\0bar");
     Assert.AreEqual("<root>foobar</root>", doc.ToCompactString());
 }
开发者ID:bjorg,项目名称:DReAM,代码行数:5,代码来源:XDoc-Test.cs

示例5: XmlNullChar_in_xml_attribute_ToCompactString

 public void XmlNullChar_in_xml_attribute_ToCompactString()
 {
     var doc = new XDoc("root").Attr("name", "foo\0bar");
     Assert.AreEqual("<root name=\"foobar\" />", doc.ToCompactString());
 }
开发者ID:bjorg,项目名称:DReAM,代码行数:5,代码来源:XDoc-Test.cs

示例6: Can_roundtrip_DispatchItem_with_complex_event

 public void Can_roundtrip_DispatchItem_with_complex_event()
 {
     var body = new XDoc("msg").Elem("foo", "bar");
     var channel = new XUri("channel://foo.com/bar");
     var resource = new XUri("http://foo.com/baz/0");
     var origin1 = new XUri("http://foo.com/baz/1");
     var origin2 = new XUri("http://foo.com/baz/2");
     var recipient1 = new DispatcherRecipient(new XUri("http://recipient1"));
     var recipient2 = new DispatcherRecipient(new XUri("http://recipient2"));
     var via1 = new XUri("http://via1");
     var via2 = new XUri("http://via2");
     var ev = new DispatcherEvent(body, channel, resource, origin1, origin2);
     ev = ev.WithRecipient(false, recipient1, recipient2).WithVia(via1).WithVia(via2);
     var item = new DispatchItem(
         new XUri("http://foo"),
         ev,
         "abc"
     );
     var serializer = new DispatchItemSerializer();
     var stream = serializer.ToStream(item);
     var item2 = serializer.FromStream(stream);
     Assert.AreEqual(item.Uri, item2.Uri, "uri mismatch");
     Assert.AreEqual(item.Location, item2.Location, "location mismatch");
     Assert.AreEqual(item.Event.Id, item2.Event.Id, "id mismatch");
     Assert.AreEqual(body.ToCompactString(), item2.Event.AsDocument().ToCompactString(), "body mismatch");
     Assert.AreEqual(channel, item2.Event.Channel, "channel mismatch");
     Assert.AreEqual(resource, item2.Event.Resource, "resource mismatch");
     Assert.AreEqual(origin1, item2.Event.Origins[0], "first origin mismatch");
     Assert.AreEqual(origin2, item2.Event.Origins[1], "second origin mismatch");
     Assert.AreEqual(recipient1.Uri, item2.Event.Recipients[0].Uri, "first recipient mismatch");
     Assert.AreEqual(recipient2.Uri, item2.Event.Recipients[1].Uri, "second recipient mismatch");
     Assert.AreEqual(via1, item2.Event.Via[0], "first via mismatch");
     Assert.AreEqual(via2, item2.Event.Via[1], "second via mismatch");
 }
开发者ID:sdether,项目名称:DReAM,代码行数:34,代码来源:DispatchItemSerializerTests.cs

示例7: FromBodyDocument

 //--- Class Methods ---
 public static AwsSqsMessage FromBodyDocument(XDoc body)
 {
     return new AwsSqsMessage { Body = body.ToCompactString() };
 }
开发者ID:heran,项目名称:DReAM,代码行数:5,代码来源:AwsSqsMessage.cs

示例8: Dispatch_for_expiring_set_happens_only_once_for_an_event

        public void Dispatch_for_expiring_set_happens_only_once_for_an_event()
        {
            // Arrange
            var doc = new XDoc("msg").Elem("foo", StringUtil.CreateAlphaNumericKey(10));
            var ev = new DispatcherEvent(
                doc,
                new XUri("channel:///foo/bar"),
                new XUri("http://foobar.com/some/page"));
            var setUpdated = false;
            _dispatcher.CombinedSetUpdated += delegate {
                setUpdated = true;
            };
            var recipientUri = new XUri("http://recipient");
            XDoc dispatched = null;
            var dispatchCount = 0;
            MockPlug.Register(recipientUri, (plug, verb, uri, request, response) => {
                dispatchCount++;
                dispatched = request.ToDocument();
                response.Return(DreamMessage.Ok());
            });
            var dispatchQueue = new MockPubSubDispatchQueue(_dequeueHandler);
            var queueResolved = false;
            _queueRepositoryMock.Setup(x => x[It.Is<PubSubSubscriptionSet>(y => y.Location == "abc")])
                .Callback(() => queueResolved = true)
                .Returns(dispatchQueue)
                .Verifiable();
            _dispatcher.RegisterSet(
                "abc",
                new XDoc("subscription-set")
                    .Attr("max-failure-duration", 100)
                    .Elem("uri.owner", "http:///owner1")
                    .Start("subscription")
                        .Attr("id", "1")
                        .Elem("channel", "channel:///foo/bar")
                        .Start("recipient").Elem("uri", recipientUri).End()
                    .End(),
                "def"
            );

            // combinedset updates happen asynchronously, so give'em a chance
            Assert.IsTrue(Wait.For(() => setUpdated, 10.Seconds()), "combined set didn't update in time");

            // Act
            _dispatcher.Dispatch(ev);

            // Assert

            // dispatch happens asynchronously so we need to wait until our mock repository was accessed
            Assert.IsTrue(
                Wait.For(() => dispatched != null, 10.Seconds()),
                "dispatch didn't happen"
            );
            Assert.IsFalse(
                Wait.For(() => dispatchCount > 1, 2.Seconds()),
                "more than one dispatch happened"
            );
            _queueRepositoryMock.VerifyAll();
            Assert.AreEqual(doc.ToCompactString(), dispatched.ToCompactString());
        }
开发者ID:sdether,项目名称:DReAM,代码行数:59,代码来源:DispatcherTests.cs


注:本文中的XDoc.ToCompactString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。