Beispiel #1
0
            /// <summary>
            /// Testing the method <see cref="ConcatCollection.GetEnumerator"/>.
            /// </summary>
            [Test] public void ConcatGetEnumerator()
            {
                // generating two arrays
                int[] array1 = new int[10], array2 = new int[13];
                for (int i = 0; i < array1.Length; i++)
                {
                    array1[i] = i;
                }
                for (int i = 0; i < array2.Length; i++)
                {
                    array2[i] = i + array1.Length;
                }

                ConcatCollection union = new ConcatCollection(array1, array2);

                int index = 0;

                foreach (int value in union)
                {
                    Assert.AreEqual(index++, value, "#A00 Unexpected value in collection.");
                }

                Assert.AreEqual(array1.Length + array2.Length, index,
                                "#A01 Unexpected count of enumerated element in collection.");
            }
Beispiel #2
0
    public ProductViewModel(IProduct product)
        : base(product)
    {
        Func <IProduct, ProductViewModel> productViewModelFactory = CreateProductViewModel;
        Func <IRelease, ReleaseViewModel> releaseViewModelFactory = CreateReleaseViewModel;

        this.Products = ViewModelCollection.Create(product.Products, productViewModelFactory);
        this.Releases = ViewModelCollection.Create(product.Releases, releaseViewModelFactory);
        this.Children = ConcatCollection.Create <object>((ICollection)this.Products, (ICollection)this.Releases);
    }
Beispiel #3
0
 public ConcatEnumerator(ConcatCollection union)
 {
     this.enumerator1 = union.c1.GetEnumerator();
     this.enumerator2 = union.c2.GetEnumerator();
     this.isEnumator1Current = true;
 }
Beispiel #4
0
            /// <summary>
            /// Testing the method <see cref="ConcatCollection.GetEnumerator"/>.
            /// </summary>
            [Test] public void ConcatGetEnumerator()
            {
                // generating two arrays
                int[] array1 = new int[10], array2 = new int[13];
                for(int i = 0; i < array1.Length; i++) array1[i] = i;
                for(int i = 0; i < array2.Length; i++) array2[i] = i + array1.Length;

                ConcatCollection union = new ConcatCollection(array1, array2);

                int index = 0;

                foreach(int value in union)
                {
                    Assert.AreEqual(index++, value, "#A00 Unexpected value in collection.");
                }

                Assert.AreEqual(array1.Length + array2.Length, index, 
                    "#A01 Unexpected count of enumerated element in collection.");
            }
Beispiel #5
0
 public ConcatEnumerator(ConcatCollection union)
 {
     this.enumerator1        = union.c1.GetEnumerator();
     this.enumerator2        = union.c2.GetEnumerator();
     this.isEnumator1Current = true;
 }
Beispiel #6
0
 ///<summary>
 ///</summary>
 ///<param name="union"></param>
 public ConcatEnumerator(ConcatCollection union)
 {
     _enumerator1          = union._c1.GetEnumerator();
     _enumerator2          = union._c2.GetEnumerator();
     _isEnumerator1Current = true;
 }