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


C# Content.Equals方法代码示例

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


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

示例1: ContentDeserializationTest_DeserializeFromJson_Success

		public void ContentDeserializationTest_DeserializeFromJson_Success()
		{
			var valuesToFill = new Content(
				// Add field.
				new FieldContent("Report date", new DateTime(2000, 01, 01).ToShortDateString()),
				// Add table.
				new TableContent("Team Members Table")
					.AddRow(
						new FieldContent("Name", "Eric"),
						new FieldContent("Role", "Program Manager"))
					.AddRow(
						new FieldContent("Name", "Bob"),
						new FieldContent("Role", "Developer")),
				// Add nested list.	
				new ListContent("Team Members Nested List")
					.AddItem(new ListItemContent("Role", "Program Manager")
						.AddNestedItem(new FieldContent("Name", "Eric"))
						.AddNestedItem(new FieldContent("Name", "Ann")))
					.AddItem(new ListItemContent("Role", "Developer")
						.AddNestedItem(new FieldContent("Name", "Bob"))
						.AddNestedItem(new FieldContent("Name", "Richard"))),
				// Add image
				new ImageContent("photo", new byte[] { 1, 2, 3 })
				);


			const string serialized = "{\"Tables\":[{\"Name\":\"Team Members Table\",\"Rows\":[{\"Tables\":[],\"Lists\":[],\"Fields\":[{\"Name\":\"Name\",\"Value\":\"Eric\"},{\"Name\":\"Role\",\"Value\":\"Program Manager\"}],\"Images\":[]},{\"Tables\":[],\"Lists\":[],\"Fields\":[{\"Name\":\"Name\",\"Value\":\"Bob\"},{\"Name\":\"Role\",\"Value\":\"Developer\"}],\"Images\":[]}],\"FieldNames\":[\"Name\",\"Role\"]}],\"Lists\":[{\"Name\":\"Team Members Nested List\",\"Items\":[{\"NestedFields\":[{\"NestedFields\":null,\"Tables\":[],\"Lists\":[],\"Fields\":[{\"Name\":\"Name\",\"Value\":\"Eric\"}],\"Images\":[]},{\"NestedFields\":null,\"Tables\":[],\"Lists\":[],\"Fields\":[{\"Name\":\"Name\",\"Value\":\"Ann\"}],\"Images\":[]}],\"Tables\":[],\"Lists\":[],\"Fields\":[{\"Name\":\"Role\",\"Value\":\"Program Manager\"}],\"Images\":[]},{\"NestedFields\":[{\"NestedFields\":null,\"Tables\":[],\"Lists\":[],\"Fields\":[{\"Name\":\"Name\",\"Value\":\"Bob\"}],\"Images\":[]},{\"NestedFields\":null,\"Tables\":[],\"Lists\":[],\"Fields\":[{\"Name\":\"Name\",\"Value\":\"Richard\"}],\"Images\":[]}],\"Tables\":[],\"Lists\":[],\"Fields\":[{\"Name\":\"Role\",\"Value\":\"Developer\"}],\"Images\":[]}],\"FieldNames\":[\"Role\",\"Name\"]}],\"Fields\":[{\"Name\":\"Report date\",\"Value\":\"01.01.2000\"}],\"Images\":[{\"Name\":\"photo\",\"Binary\":\"AQID\"}]}";

			var deserialized = JsonConvert.DeserializeObject<Content>(serialized);

			Assert.IsTrue(valuesToFill.Equals(deserialized));
		}
开发者ID:UNIT6-open,项目名称:TemplateEngine.Docx,代码行数:32,代码来源:ContentTests.cs

示例2: ContentDeserializationTest_EmptyContentDeserializeFromJson_Success

		public void ContentDeserializationTest_EmptyContentDeserializeFromJson_Success()
		{
			var valuesToFill = new Content();

			const string serialized = "{\"Tables\":[],\"Lists\":[],\"Fields\":[],\"Images\":[]}";

			var deserialized = JsonConvert.DeserializeObject<Content>(serialized);

			Assert.IsTrue(valuesToFill.Equals(deserialized));
		}
开发者ID:UNIT6-open,项目名称:TemplateEngine.Docx,代码行数:10,代码来源:ContentTests.cs

示例3: EqualsTest_CopareWithNull_NotEquals

		public void EqualsTest_CopareWithNull_NotEquals()
		{

			var firstValuesToFill = new Content(
				// Add field.
				new FieldContent("Report date", new DateTime(2000, 01, 01).ToShortDateString()),
				// Add table.
				new TableContent("Team Members Table")
					.AddRow(
						new FieldContent("Name", "Eric"),
						new FieldContent("Role", "Program Manager"))
					.AddRow(
						new FieldContent("Name", "Bob"),
						new FieldContent("Role", "Developer"))
				);

			Assert.IsFalse(firstValuesToFill.Equals(null));

		}
开发者ID:UNIT6-open,项目名称:TemplateEngine.Docx,代码行数:19,代码来源:ContentTests.cs

示例4: EqualsTest_ObjectsAreEqual_Equals

		public void EqualsTest_ObjectsAreEqual_Equals()
		{
			
			var firstValuesToFill = new Content(
				// Add field.
				new FieldContent("Report date", new DateTime(2000, 01, 01).ToShortDateString()),
				// Add table.
				new TableContent("Team Members Table")
					.AddRow(
						new FieldContent("Name", "Eric"),
						new FieldContent("Role", "Program Manager"))
					.AddRow(
						new FieldContent("Name", "Bob"),
						new FieldContent("Role", "Developer")),
				// Add nested list.	
				new ListContent("Team Members Nested List")
					.AddItem(new ListItemContent("Role", "Program Manager")
						.AddNestedItem(new FieldContent("Name", "Eric"))
						.AddNestedItem(new FieldContent("Name", "Ann")))
					.AddItem(new ListItemContent("Role", "Developer")
						.AddNestedItem(new FieldContent("Name", "Bob"))
						.AddNestedItem(new FieldContent("Name", "Richard"))),
				// Add image
				new ImageContent("photo", new byte[] { 1, 2, 3 })
				);

			var secondValuesToFill = new Content(
				// Add field.
				new FieldContent("Report date", new DateTime(2000, 01, 01).ToShortDateString()),
				// Add table.
				new TableContent("Team Members Table")
					.AddRow(
						new FieldContent("Name", "Eric"),
						new FieldContent("Role", "Program Manager"))
					.AddRow(
						new FieldContent("Name", "Bob"),
						new FieldContent("Role", "Developer")),
				// Add nested list.	
				new ListContent("Team Members Nested List")
					.AddItem(new ListItemContent("Role", "Program Manager")
						.AddNestedItem(new FieldContent("Name", "Eric"))
						.AddNestedItem(new FieldContent("Name", "Ann")))
					.AddItem(new ListItemContent("Role", "Developer")
						.AddNestedItem(new FieldContent("Name", "Bob"))
						.AddNestedItem(new FieldContent("Name", "Richard"))),
				// Add image
				new ImageContent("photo", new byte[] { 1, 2, 3 })
				);

			Assert.IsTrue(firstValuesToFill.Equals(secondValuesToFill));

		}
开发者ID:UNIT6-open,项目名称:TemplateEngine.Docx,代码行数:52,代码来源:ContentTests.cs


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