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


C# DetailCollection类代码示例

本文整理汇总了C#中DetailCollection的典型用法代码示例。如果您正苦于以下问题:C# DetailCollection类的具体用法?C# DetailCollection怎么用?C# DetailCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: CanClone_Collection

        public void CanClone_Collection()
        {
            DetailCollection collection = new DetailCollection();
            collection.Add("hello");

            DetailCollection cloned = collection.Clone();
            Assert.That(cloned.Contains("hello"));
        }
开发者ID:spmason,项目名称:n2cms,代码行数:8,代码来源:DetailCollectionTests.cs

示例2: CanAddRange

		public void CanAddRange()
		{
			DetailCollection collection = new DetailCollection();
			collection.AddRange(new[] {"hello", "world"});

			Assert.That(collection[0], Is.EqualTo("hello"));
			Assert.That(collection[1], Is.EqualTo("world"));
		}
开发者ID:rickyinnz,项目名称:n2cms,代码行数:8,代码来源:DetailCollectionTests.cs

示例3: CanRemove_AtIndex

		public void CanRemove_AtIndex()
		{
			DetailCollection collection = new DetailCollection(null, null, "hello", "world");

			collection.RemoveAt(0);

			Assert.That(collection.Count, Is.EqualTo(1));
			Assert.That(collection[0], Is.EqualTo("world"));
		}
开发者ID:rickyinnz,项目名称:n2cms,代码行数:9,代码来源:DetailCollectionTests.cs

示例4: CanAdd_StringDetail

        public void CanAdd_StringDetail()
        {
            DetailCollection collection = new DetailCollection();
            collection.Add("hello");

            Assert.That(collection[0], Is.EqualTo("hello"));
            Assert.That(collection.Details[0], Is.TypeOf(typeof(StringDetail)));
            Assert.That(collection.Details[0].Value, Is.EqualTo("hello"));
        }
开发者ID:spmason,项目名称:n2cms,代码行数:9,代码来源:DetailCollectionTests.cs

示例5: CanClear_DetailCollection

        public void CanClear_DetailCollection()
        {
            DetailCollection collection = new DetailCollection();
            collection.Add("hello");

            collection.Clear();

            Assert.That(collection.Count, Is.EqualTo(0));
        }
开发者ID:spmason,项目名称:n2cms,代码行数:9,代码来源:DetailCollectionTests.cs

示例6: CanAdd_IntDetail

        public void CanAdd_IntDetail()
        {
            DetailCollection collection = new DetailCollection();
            collection.Add(1);

            Assert.That(collection[0], Is.EqualTo(1));
            Assert.That(collection.Details[0], Is.TypeOf(typeof(IntegerDetail)));
            Assert.That(collection.Details[0].Value, Is.EqualTo(1));
        }
开发者ID:spmason,项目名称:n2cms,代码行数:9,代码来源:DetailCollectionTests.cs

示例7: CanFind_IndexOfInteger

		public void CanFind_IndexOfInteger()
		{
			DetailCollection collection = new DetailCollection();
			collection.Add(1);
			collection.Add(2);

			Assert.That(collection.IndexOf(1), Is.EqualTo(0));
			Assert.That(collection.IndexOf(2), Is.EqualTo(1));
		}
开发者ID:rickyinnz,项目名称:n2cms,代码行数:9,代码来源:DetailCollectionTests.cs

示例8: CanInsert_IntoCollection

		public void CanInsert_IntoCollection()
		{
			DetailCollection collection = new DetailCollection();
			collection.Insert(0, "hello");
			collection.Insert(0, "world");

			Assert.That(collection.IndexOf("hello"), Is.EqualTo(1));
			Assert.That(collection.IndexOf("world"), Is.EqualTo(0));
		}
开发者ID:rickyinnz,项目名称:n2cms,代码行数:9,代码来源:DetailCollectionTests.cs

示例9: CanAdd_StringDetail

		public void CanAdd_StringDetail()
		{
			DetailCollection collection = new DetailCollection();
			collection.Add("hello");

			Assert.That(collection[0], Is.EqualTo("hello"));
			Assert.That(collection.Details[0].ValueType, Is.EqualTo(typeof(string)));
			Assert.That(collection.Details[0].ValueTypeKey, Is.EqualTo(ContentDetail.TypeKeys.StringType));
			Assert.That(collection.Details[0].Value, Is.EqualTo("hello"));
		}
开发者ID:rickyinnz,项目名称:n2cms,代码行数:10,代码来源:DetailCollectionTests.cs

示例10: GetCurrentTags

 List<ITag> GetCurrentTags(IGroup group, DetailCollection links)
 {
     List<ITag> tags = new List<ITag>();
     foreach (ContentItem link in links)
     {
         if(link.Parent != null && link.Parent.Equals(group))
             tags.Add(link as ITag);
     }
     return tags;
 }
开发者ID:EzyWebwerkstaden,项目名称:n2cms,代码行数:10,代码来源:EditableTagsAttribute.cs

示例11: CanAdd_IntDetail

		public void CanAdd_IntDetail()
		{
			DetailCollection collection = new DetailCollection();
			collection.Add(1);

			Assert.That(collection[0], Is.EqualTo(1));
			Assert.That(collection.Details[0].ValueType, Is.EqualTo(typeof(int)));
			Assert.That(collection.Details[0].ValueTypeKey, Is.EqualTo(ContentDetail.TypeKeys.IntType));
			Assert.That(collection.Details[0].Value, Is.EqualTo(1));
		}
开发者ID:rickyinnz,项目名称:n2cms,代码行数:10,代码来源:DetailCollectionTests.cs

示例12: ReadDetail

        protected virtual void ReadDetail(XPathNavigator navigator, DetailCollection collection, ReadingJournal journal)
        {
            Dictionary<string, string> attributes = GetAttributes(navigator);
            Type type = Utility.TypeFromName(attributes["typeName"]);

			string meta = attributes.ContainsKey("meta") ? attributes["meta"] : null;
            if (type == typeof(ContentItem))
            {
                int referencedItemID = int.Parse(navigator.Value);
                ContentItem referencedItem = journal.Find(referencedItemID);
                if (referencedItem != null)
                {
                    collection.Add(ContentDetail.New(
                        collection.EnclosingItem,
                        attributes["name"],
                        referencedItem, 
						meta));
                }
                else
                {
                    journal.Register(referencedItemID, (item) => 
                        {
                            collection.Add(ContentDetail.New(
                                collection.EnclosingItem,
                                attributes["name"],
                                item,
								meta));
                        }, relationType: "collectionlink");
                }
            }
            else if (type == typeof(Enum))
            {
                if (meta != null)
                {
                    collection.Add(ContentDetail.New(
                        collection.EnclosingItem,
                        attributes["name"],
                        Parse(navigator.Value, Type.GetType(meta))));
                }
            }
            else if (type == typeof(IMultipleValue))
            {
				var detail = detailReader.ReadMultipleValue(navigator, collection.EnclosingItem, journal, collection.Name);
				detail.Meta = meta;
				detail.AddTo(collection);
            }
            else
            {
                object value = Parse(navigator.Value, type);
                if (value is string)
                    value = detailReader.PrepareStringDetail(collection.EnclosingItem, collection.Name, value as string, attributes.ContainsKey("encoded") && Convert.ToBoolean(attributes["encoded"]));

                collection.Add(ContentDetail.New(collection.EnclosingItem, attributes["name"], value, meta));
            }
        }
开发者ID:EzyWebwerkstaden,项目名称:n2cms,代码行数:55,代码来源:DetailCollectionXmlReader.cs

示例13: CanConvert_ToArray

        public void CanConvert_ToArray()
        {
            DetailCollection collection = new DetailCollection();
            collection.AddRange(new[] { 1, 2, 3 });

            int[] array = collection.ToArray<int>();

            Assert.That(array.Length, Is.EqualTo(3));
            Assert.That(array[0], Is.EqualTo(1));
            Assert.That(array[2], Is.EqualTo(3));
        }
开发者ID:spmason,项目名称:n2cms,代码行数:11,代码来源:DetailCollectionTests.cs

示例14: WriteDetailCollection

		protected virtual void WriteDetailCollection(ContentItem item, XmlTextWriter writer, DetailCollection collection)
		{
			using (ElementWriter collectionElement = new ElementWriter("collection", writer))
			{
				collectionElement.WriteAttribute("name", collection.Name);
				foreach (ContentDetail detail in collection.Details)
				{
					WriteDetail(item, detail, writer);
				}
			}
		}
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:11,代码来源:DetailCollectionXmlWriter.cs

示例15: CanConvert_ToList

        public void CanConvert_ToList()
        {
            DetailCollection collection = new DetailCollection();
            collection.AddRange(new[] { 1, 2, 3 });

            IList<int> list = collection.ToList<int>();

            Assert.That(list.Count, Is.EqualTo(3));
            Assert.That(list[0], Is.EqualTo(1));
            Assert.That(list[2], Is.EqualTo(3));
        }
开发者ID:spmason,项目名称:n2cms,代码行数:11,代码来源:DetailCollectionTests.cs


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