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


C# JsonPatcher.ToString方法代码示例

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


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

示例1: PropertyAddition_WithConcurrenty_ExistingValueOn_Ok

 public void PropertyAddition_WithConcurrenty_ExistingValueOn_Ok()
 {
     JObject apply = new JsonPatcher(doc).Apply(
         JArray.Parse(@"[{  ""type"":""set"",""name"": ""body"", ""value"": ""differnt markup"", ""prevVal"": ""html markup"" }]")
         );
     Assert.Equal(@"{""title"":""A Blog Post"",""body"":""differnt markup"",""comments"":[{""author"":""ayende"",""text"":""good post""}]}", apply.ToString(Formatting.None));
 }
开发者ID:torkelo,项目名称:ravendb,代码行数:7,代码来源:SimplePatchApplication.cs

示例2: PropertyRemovalPropertyDoesNotExists

        public void PropertyRemovalPropertyDoesNotExists()
        {
            var patchedDoc = new JsonPatcher(doc).Apply(
                JArray.Parse(@"[{ ""type"": ""unset"", ""name"": ""ip"" }]")
                );

            Assert.Equal(@"{""title"":""A Blog Post"",""body"":""html markup"",""comments"":[{""author"":""ayende"",""text"":""good post""}]}", patchedDoc.ToString(Formatting.None));
        }
开发者ID:torkelo,项目名称:ravendb,代码行数:8,代码来源:SimplePatchApplication.cs

示例3: AddingItemToArray_WithConcurrency_Ok

        public void AddingItemToArray_WithConcurrency_Ok()
        {
            var patchedDoc = new JsonPatcher(doc).Apply(
                JArray.Parse(@"[{ ""type"": ""add"" , ""name"": ""comments"", ""value"": {""author"":""oren"",""text"":""agreed""}, ""prevVal"": [{""author"":""ayende"",""text"":""good post 1""},{author: ""ayende"", text:""good post 2""}] }]")
                );

            Assert.Equal(@"{""title"":""A Blog Post"",""body"":""html markup"",""comments"":[{""author"":""ayende"",""text"":""good post 1""},{""author"":""ayende"",""text"":""good post 2""},{""author"":""oren"",""text"":""agreed""}]}",
                patchedDoc.ToString(Formatting.None));
        }
开发者ID:torkelo,项目名称:ravendb,代码行数:9,代码来源:ArrayPatching.cs

示例4: PropertyAddition_WithConcurrenty_MissingProp

        public void PropertyAddition_WithConcurrenty_MissingProp()
        {
            var patchedDoc = new JsonPatcher(doc).Apply(
                JArray.Parse(@"[{  ""type"":""set"",""name"": ""blog_id"", ""value"": 1, ""prevVal"": undefined }]")
                );

            Assert.Equal(@"{""title"":""A Blog Post"",""body"":""html markup"",""comments"":[{""author"":""ayende"",""text"":""good post""}],""blog_id"":1}",
                patchedDoc.ToString(Formatting.None));
        }
开发者ID:torkelo,项目名称:ravendb,代码行数:9,代码来源:SimplePatchApplication.cs

示例5: AddingItemToArrayWhenArrayDoesNotExists_WithConcurrency_Ok

        public void AddingItemToArrayWhenArrayDoesNotExists_WithConcurrency_Ok()
        {
            var patchedDoc = new JsonPatcher(doc).Apply(
                JArray.Parse(@"[{ ""type"":""add"",  ""name"": ""blog_id"", ""value"": 1, ""prevVal"": undefined }]")
                );

            Assert.Equal(@"{""title"":""A Blog Post"",""body"":""html markup"",""comments"":[{""author"":""ayende"",""text"":""good post 1""},{""author"":""ayende"",""text"":""good post 2""}],""blog_id"":[1]}",
                patchedDoc.ToString(Formatting.None));
        }
开发者ID:torkelo,项目名称:ravendb,代码行数:9,代码来源:ArrayPatching.cs

示例6: SetValueNestedInArray

        public void SetValueNestedInArray()
        {
            var patchedDoc = new JsonPatcher(doc).Apply(
                JArray.Parse(
                    @"[{ ""type"": ""modify"",  ""name"": ""comments"", ""position"": 1, ""value"": [{ ""type"":""set"",""name"":""author"",""value"":""oren""} ]}]")
                );

            Assert.Equal(@"{""title"":""A Blog Post"",""body"":""html markup"",""comments"":[{""author"":""ayende"",""text"":""good post 1""},{""author"":""oren"",""text"":""good post 2""}],""user"":{""name"":""ayende"",""id"":13}}",
                patchedDoc.ToString(Formatting.None));
        }
开发者ID:torkelo,项目名称:ravendb,代码行数:10,代码来源:NestedPatching.cs

示例7: PropertyMove

		public void PropertyMove()
		{
			var patchedDoc = new JsonPatcher(doc).Apply(
				new[]
        		{
        			new PatchRequest
        			{
        				Type = PatchCommandType.Rename,
        				Name = "comments",
        				Value = new JValue("cmts")
        			},
        		});

			Assert.Equal(@"{""title"":""A Blog Post"",""body"":""html markup"",""cmts"":[{""author"":""ayende"",""text"":""good post""}]}",
				patchedDoc.ToString(Formatting.None));
		}
开发者ID:Rationalle,项目名称:ravendb,代码行数:16,代码来源:SimplePatchApplication.cs

示例8: ExistingPropertySetToArray

        public void ExistingPropertySetToArray()
        {
            var patchedDoc = new JsonPatcher(doc).Apply(
                new[]
                {
                    new PatchRequest
                    {
                        Type = PatchCommandType.Set,
                        Name = "title",
                        Value = new RavenJArray()
                    },
                });

            Assert.Equal(@"{""title"":[],""body"":""html markup"",""comments"":[{""author"":""ayende"",""text"":""good post""}]}",
                patchedDoc.ToString(Formatting.None));
        }
开发者ID:j2jensen,项目名称:ravendb,代码行数:16,代码来源:SimplePatchApplication.cs

示例9: PropertyAddition

		public void PropertyAddition()
		{
			var patchedDoc = new JsonPatcher(doc).Apply(
				new[]
				{
					new PatchRequest
					{
						Type = PatchCommandType.Set,
						Name = "blog_id",
						Value = new RavenJValue(1)
					},
				});

			Assert.Equal(@"{""title"":""A Blog Post"",""body"":""html markup"",""comments"":[{""author"":""ayende"",""text"":""good post""}],""blog_id"":1}",
				patchedDoc.ToString(Formatting.None));
		}
开发者ID:WimVergouwe,项目名称:ravendb,代码行数:16,代码来源:SimplePatchApplication.cs

示例10: AddingItemToArrayWhenArrayDoesNotExists

        public void AddingItemToArrayWhenArrayDoesNotExists()
        {
            var patchedDoc = new JsonPatcher(doc).Apply(
                new[]
                {
                    new PatchRequest
                    {
                        Type = "add",
                        Name = "blog_id",
                        Value = new JValue(1),
                    }
                });

            Assert.Equal(@"{""title"":""A Blog Post"",""body"":""html markup"",""comments"":[{""author"":""ayende"",""text"":""good post 1""},{""author"":""ayende"",""text"":""good post 2""}],""blog_id"":[1]}",
                patchedDoc.ToString(Formatting.None));
        }
开发者ID:kenegozi,项目名称:ravendb,代码行数:16,代码来源:ArrayPatching.cs

示例11: PropertyCopyNonExistingProperty

		public void PropertyCopyNonExistingProperty()
		{
			var patchedDoc = new JsonPatcher(doc).Apply(
				new[]
				{
					new PatchRequest
					{
						Type = PatchCommandType.Copy,
						Name = "non-existing",
						Value = new RavenJValue("irrelevant")
					},
				});

			Assert.Equal(@"{""title"":""A Blog Post"",""body"":""html markup"",""comments"":[{""author"":""ayende"",""text"":""good post""}]}",
				patchedDoc.ToString(Formatting.None));
		}
开发者ID:WimVergouwe,项目名称:ravendb,代码行数:16,代码来源:SimplePatchApplication.cs

示例12: PropertyAddition_WithConcurrenty_ExistingValueOn_Ok

        public void PropertyAddition_WithConcurrenty_ExistingValueOn_Ok()
        {
            JObject apply = new JsonPatcher(doc).Apply(
                new[]
                {
                    new PatchRequest
                    {
                        Type = "set",
                        Name = "body",
                        Value = new JValue("differnt markup"),
                        PrevVal = new JValue("html markup")
                    },
                });

            Assert.Equal(@"{""title"":""A Blog Post"",""body"":""differnt markup"",""comments"":[{""author"":""ayende"",""text"":""good post""}]}", apply.ToString(Formatting.None));
        }
开发者ID:kenegozi,项目名称:ravendb,代码行数:16,代码来源:SimplePatchApplication.cs

示例13: AddingEmptyObject

		public void AddingEmptyObject()
		{
			var patchedDoc = new JsonPatcher(doc).Apply(
				new[]
				{
					new PatchRequest
					{
						Type = PatchCommandType.Set,
						Name = "NewProp",
						Value = new RavenJObject()

					}
				});

			Assert.Equal(@"{""title"":""A Blog Post"",""body"":""html markup"",""comments"":[{""author"":""ayende"",""text"":""good post 1""},{""author"":""ayende"",""text"":""good post 2""}],""NewProp"":{}}",
				patchedDoc.ToString(Formatting.None));
		}
开发者ID:WimVergouwe,项目名称:ravendb,代码行数:17,代码来源:ArrayPatching.cs

示例14: AddingItemToArray

        public void AddingItemToArray()
        {
        	var patchedDoc = new JsonPatcher(doc).Apply(
        		new[]
        		{
        			new PatchRequest
        			{
        				Type = PatchCommandType.Add,
        				Name = "comments",
        				Value = RavenJObject.Parse(@"{""author"":""oren"",""text"":""agreed""}")

        			}
        		});

            Assert.Equal(@"{""title"":""A Blog Post"",""body"":""html markup"",""comments"":[{""author"":""ayende"",""text"":""good post 1""},{""author"":""ayende"",""text"":""good post 2""},{""author"":""oren"",""text"":""agreed""}]}", 
                patchedDoc.ToString(Formatting.None));
        }
开发者ID:nzdunic,项目名称:ravendb,代码行数:17,代码来源:ArrayPatching.cs

示例15: SetValueInNestedElement

        public void SetValueInNestedElement()
        {
        	var patchedDoc = new JsonPatcher(doc).Apply(
        		new[]
        		{
        			new PatchRequest
        			{
        				Type = PatchCommandType.Modify,
        				Name = "user",
        				Nested = new[]
        				{
        					new PatchRequest {Type = PatchCommandType.Set, Name = "name", Value = new JValue("rahien")},
        				}
        			},
        		});

            Assert.Equal(@"{""title"":""A Blog Post"",""body"":""html markup"",""comments"":[{""author"":""ayende"",""text"":""good post 1""},{""author"":""ayende"",""text"":""good post 2""}],""user"":{""name"":""rahien"",""id"":13}}",
                patchedDoc.ToString(Formatting.None));
        }
开发者ID:philiphoy,项目名称:ravendb,代码行数:19,代码来源:NestedPatching.cs


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