Esempio n. 1
0
        public void CanGet_StronglyTypeEnumerator()
        {
            DetailCollection collection = new DetailCollection();

            collection.AddRange(new object[] { 1, 2, 3 });

            foreach (int number in collection.Enumerate <int>())
            {
                Assert.That(number >= 1 && number <= 3);
            }
        }
Esempio n. 2
0
        private void ClearMissingDetails(ContentItem source, ContentItem destination)
        {
            // remove details not present in source
            List <string> detailKeys = new List <string>(destination.Details.Keys);

            foreach (string key in detailKeys)
            {
                if (!source.Details.ContainsKey(key))
                {
                    destination.Details.Remove(key);
                }
            }

            List <string> collectionKeys = new List <string>(destination.DetailCollections.Keys);

            foreach (string key in collectionKeys)
            {
                if (source.DetailCollections.ContainsKey(key))
                {
                    // remove detail collection values not present in source
                    DetailCollection destinationCollection = destination.DetailCollections[key];
                    DetailCollection sourceCollection      = source.DetailCollections[key];
                    List <object>    values = new List <object>(destinationCollection.Enumerate <object>());
                    foreach (object value in values)
                    {
                        if (!sourceCollection.Contains(value))
                        {
                            destinationCollection.Remove(value);
                        }
                    }
                }
                else
                {
                    // remove detail collections not present in source
                    destination.DetailCollections.Remove(key);
                }
            }
        }
Esempio n. 3
0
		public void CanGet_StronglyTypeEnumerator()
		{
			DetailCollection collection = new DetailCollection();
			collection.AddRange(new object[] { 1, 2, 3 });

			foreach (int number in collection.Enumerate<int>())
			{
				Assert.That(number >= 1 && number <= 3);
			}
		}