Merge remote-tracking branch 'origin/master' into tizen
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / internal / Utility / TSItemCollection.cs
1 using global::System;
2 using NUnit.Framework;
3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
6
7 namespace Tizen.NUI.Devel.Tests
8 {
9     using tlog = Tizen.Log;
10
11     [TestFixture]
12     [Description("Internal/Utility/ItemCollection")]
13     public class InternalItemCollectionTest
14     {
15         private const string tag = "NUITEST";
16
17         [SetUp]
18         public void Init()
19         {
20             tlog.Info(tag, "Init() is called!");
21         }
22
23         [TearDown]
24         public void Destroy()
25         {
26             tlog.Info(tag, "Destroy() is called!");
27         }
28
29         [Test]
30         [Category("P1")]
31         [Description("ItemCollection constructor.")]
32         [Property("SPEC", "Tizen.NUI.ItemCollection.ItemCollection C")]
33         [Property("SPEC_URL", "-")]
34         [Property("CRITERIA", "CONSTR")]
35         [Property("AUTHOR", "guowei.wang@samsung.com")]
36         public void ItemCollectionConstructor()
37         {
38             tlog.Debug(tag, $"ItemCollectionConstructor START");
39
40             var testingTarget = new ItemCollection();
41             Assert.IsNotNull(testingTarget, "Should be not null!");
42             Assert.IsInstanceOf<ItemCollection>(testingTarget, "Should be an Instance of ItemCollection!");
43
44             Assert.IsFalse(testingTarget.IsFixedSize);
45             Assert.IsFalse(testingTarget.IsReadOnly);
46             Assert.IsFalse(testingTarget.IsSynchronized);
47
48             testingTarget.Dispose();
49             tlog.Debug(tag, $"ItemCollectionConstructor END (OK)");
50         }
51
52         [Test]
53         [Category("P1")]
54         [Description("ItemCollection constructor. With ItemCollection.")]
55         [Property("SPEC", "Tizen.NUI.ItemCollection.ItemCollection C")]
56         [Property("SPEC_URL", "-")]
57         [Property("CRITERIA", "CONSTR")]
58         [Property("AUTHOR", "guowei.wang@samsung.com")]
59         public void ItemCollectionConstructorWithItemCollection()
60         {
61             tlog.Debug(tag, $"ItemCollectionConstructorWithItemCollection START");
62
63             using (ItemCollection itemCollection = new ItemCollection())
64             {
65                 var testingTarget = new ItemCollection(itemCollection);
66                 Assert.IsNotNull(testingTarget, "Should be not null!");
67                 Assert.IsInstanceOf<ItemCollection>(testingTarget, "Should be an Instance of ItemCollection!");
68
69                 testingTarget.Dispose();
70             }
71
72             tlog.Debug(tag, $"ItemCollectionConstructorWithItemCollection END (OK)");
73         }
74
75         [Test]
76         [Category("P1")]
77         [Description("ItemCollection constructor. With capacity.")]
78         [Property("SPEC", "Tizen.NUI.ItemCollection.ItemCollection C")]
79         [Property("SPEC_URL", "-")]
80         [Property("CRITERIA", "CONSTR")]
81         [Property("AUTHOR", "guowei.wang@samsung.com")]
82         public void ItemCollectionConstructorWithCapacity()
83         {
84             tlog.Debug(tag, $"ItemCollectionConstructorWithCapacity START");
85
86             var testingTarget = new ItemCollection(5);
87             Assert.IsNotNull(testingTarget, "Should be not null!");
88             Assert.IsInstanceOf<ItemCollection>(testingTarget, "Should be an Instance of ItemCollection!");
89
90             testingTarget.Dispose();
91             tlog.Debug(tag, $"ItemCollectionConstructorWithCapacity END (OK)");
92         }
93
94         [Test]
95         [Category("P1")]
96         [Description("ItemCollection constructor. With ICollection.")]
97         [Property("SPEC", "Tizen.NUI.ItemCollection.ItemCollection C")]
98         [Property("SPEC_URL", "-")]
99         [Property("CRITERIA", "CONSTR")]
100         [Property("AUTHOR", "guowei.wang@samsung.com")]
101         public void ItemCollectionConstructorWithICollection()
102         {
103             tlog.Debug(tag, $"ItemCollectionConstructorWithICollection START");
104
105             Item[] b = new Item[] { new Item(), new Item(), new Item(), new Item() };
106             global::System.Collections.ICollection c = b;
107             var testingTarget = new ItemCollection(c);
108             Assert.IsNotNull(testingTarget, "Should be not null!");
109             Assert.IsInstanceOf<ItemCollection>(testingTarget, "Should be an Instance of ItemCollection!");
110
111             Assert.AreEqual(4, testingTarget.Count, "Should be equal!");
112
113             testingTarget.Dispose();
114             tlog.Debug(tag, $"ItemCollectionConstructorWithICollection END (OK)");
115         }
116
117         [Test]
118         [Category("P2")]
119         [Description("ItemCollection constructor. With null ICollection.")]
120         [Property("SPEC", "Tizen.NUI.ItemCollection.ItemCollection C")]
121         [Property("SPEC_URL", "-")]
122         [Property("CRITERIA", "CONSTR")]
123         [Property("AUTHOR", "guowei.wang@samsung.com")]
124         public void ItemCollectionConstructorWithNullICollection()
125         {
126             tlog.Debug(tag, $"ItemCollectionConstructorWithNullICollection START");
127
128             global::System.Collections.ICollection c = null;
129
130             try
131             {
132                 new ItemCollection(c);
133             }
134             catch (ArgumentNullException e)
135             {
136                 tlog.Debug(tag, e.Message.ToString());
137                 tlog.Debug(tag, $"ItemCollectionConstructorWithNullICollection END (OK)");
138                 Assert.Pass("Caught ArgumentNullException: Passed!");
139             }
140         }
141
142         [Test]
143         [Category("P1")]
144         [Description("ItemCollection Clear.")]
145         [Property("SPEC", "Tizen.NUI.ItemCollection.Clear M")]
146         [Property("SPEC_URL", "-")]
147         [Property("CRITERIA", "MR")]
148         [Property("AUTHOR", "guowei.wang@samsung.com")]
149         public void ItemCollectionClear()
150         {
151             tlog.Debug(tag, $"ItemCollectionClear START");
152
153             Item[] b = new Item[] { new Item(), new Item(), new Item(), new Item() };
154             global::System.Collections.ICollection c = b;
155            
156             var testingTarget = new ItemCollection(c);
157             Assert.IsNotNull(testingTarget, "Should be not null!");
158             Assert.IsInstanceOf<ItemCollection>(testingTarget, "Should be an Instance of ItemCollection!");
159             tlog.Debug(tag, "Count : " + testingTarget.Count.ToString());
160            
161
162             try
163             {
164                 testingTarget.Clear();
165                 tlog.Debug(tag, "Count : " + testingTarget.Count.ToString());
166             }
167             catch (Exception e)
168             {
169                 tlog.Debug(tag, e.Message.ToString());
170                 Assert.Fail("Caught Exception: Failed!");
171             }
172
173             testingTarget.Dispose();
174             tlog.Debug(tag, $"ItemCollectionClear END (OK)");
175         }
176
177         [Test]
178         [Category("P1")]
179         [Description("ItemCollection this.")]
180         [Property("SPEC", "Tizen.NUI.ItemCollection.this A")]
181         [Property("SPEC_URL", "-")]
182         [Property("CRITERIA", "PRW")]
183         [Property("AUTHOR", "guowei.wang@samsung.com")]
184         public void ItemCollectionGetVauleByIndex()
185         {
186             tlog.Debug(tag, $"ItemCollectionGetVauleByIndex START");
187
188             Item[] b = new Item[] { new Item(), new Item(), new Item(), new Item() };
189             global::System.Collections.ICollection c = b;
190             var testingTarget = new ItemCollection(c);
191             Assert.IsNotNull(testingTarget, "Should be not null!");
192             Assert.IsInstanceOf<ItemCollection>(testingTarget, "Should be an Instance of ItemCollection!");
193
194             testingTarget[2].first = 3;
195             Assert.AreEqual(3, testingTarget[2].first, "Should be equal!");
196
197             try
198             {
199                 testingTarget[1] = new Item(testingTarget[2]);
200                 Assert.AreEqual(3, testingTarget[1].first, "Should be equal!");
201             }
202             catch (Exception e)
203             {
204                 tlog.Debug(tag, e.Message.ToString());
205                 Assert.Fail("Caught Exception: Failed!");
206             }
207
208             testingTarget.Dispose();
209             tlog.Debug(tag, $"ItemCollectionGetVauleByIndex END (OK)");
210         }
211
212         [Test]
213         [Category("P1")]
214         [Description("ItemCollection Capacity.")]
215         [Property("SPEC", "Tizen.NUI.ItemCollection.Capacity A")]
216         [Property("SPEC_URL", "-")]
217         [Property("CRITERIA", "PRW")]
218         [Property("AUTHOR", "guowei.wang@samsung.com")]
219         public void ItemCollectionCapacity()
220         {
221             tlog.Debug(tag, $"ItemCollectionCapacity START");
222
223             Item[] b = new Item[] { new Item(), new Item(), new Item(), new Item() };
224             global::System.Collections.ICollection c = b;
225             var testingTarget = new ItemCollection(c);
226             Assert.IsNotNull(testingTarget, "Should be not null!");
227             Assert.IsInstanceOf<ItemCollection>(testingTarget, "Should be an Instance of ItemCollection!");
228
229             Assert.AreEqual(4, testingTarget.Capacity, "Should be equal!");
230
231             testingTarget.Capacity = 8;
232             Assert.AreEqual(8, testingTarget.Capacity, "Should be equal!");
233
234             testingTarget.Dispose();
235             tlog.Debug(tag, $"ItemCollectionCapacity END (OK)");
236         }
237
238         [Test]
239         [Category("P2")]
240         [Description("ItemCollection Capacity. Set exception.")]
241         [Property("SPEC", "Tizen.NUI.ItemCollection.Capacity A")]
242         [Property("SPEC_URL", "-")]
243         [Property("CRITERIA", "PRW")]
244         [Property("AUTHOR", "guowei.wang@samsung.com")]
245         public void ItemCollectionCapacitySetException()
246         {
247             tlog.Debug(tag, $"ItemCollectionCapacitySetException START");
248
249             Item[] b = new Item[] { new Item(), new Item(), new Item(), new Item() };
250             global::System.Collections.ICollection c = b;
251             var testingTarget = new ItemCollection(c);
252             Assert.IsNotNull(testingTarget, "Should be not null!");
253             Assert.IsInstanceOf<ItemCollection>(testingTarget, "Should be an Instance of ItemCollection!");
254
255             Assert.AreEqual(4, testingTarget.Capacity, "Should be equal!");
256
257             try
258             {
259                 testingTarget.Capacity = 2;
260             }
261             catch (ArgumentOutOfRangeException e)
262             {
263                 tlog.Debug(tag, e.Message.ToString());
264                 testingTarget.Dispose();
265                 tlog.Debug(tag, $"ItemCollectionCapacitySetException END (OK)");
266                 Assert.Pass("Caught ArgumentOutOfRangeException: Passed!");
267             }
268         }
269
270         [Test]
271         [Category("P1")]
272         [Description("ItemCollection CopyTo.")]
273         [Property("SPEC", "Tizen.NUI.ItemCollection.CopyTo M")]
274         [Property("SPEC_URL", "-")]
275         [Property("CRITERIA", "MR")]
276         [Property("AUTHOR", "guowei.wang@samsung.com")]
277         public void ItemCollectionCopyTo()
278         {
279             tlog.Debug(tag, $"ItemCollectionCopyTo START");
280
281             Item[] b = new Item[] { new Item(), new Item(), new Item(), new Item() };
282             global::System.Collections.ICollection c = b;
283             var testingTarget = new ItemCollection(c);
284             Assert.IsNotNull(testingTarget, "Should be not null!");
285             Assert.IsInstanceOf<ItemCollection>(testingTarget, "Should be an Instance of ItemCollection!");
286
287             Item[] array = new Item[4];
288
289             try
290             {
291                 testingTarget.CopyTo(array);
292                 Assert.IsNotNull(array[1], "Should be not null!");
293                 Assert.IsInstanceOf<Item>(array[1], "Should be an Instance of Item!");
294             }
295             catch (Exception e)
296             {
297                 tlog.Debug(tag, e.Message.ToString());
298                 Assert.Fail("Caught Exception: Failed!");
299             }
300
301             testingTarget.Dispose();
302             tlog.Debug(tag, $"ItemCollectionCopyTo END (OK)");
303         }
304
305         [Test]
306         [Category("P1")]
307         [Description("ItemCollection CopyTo. With arrayIndex.")]
308         [Property("SPEC", "Tizen.NUI.ItemCollection.CopyTo M")]
309         [Property("SPEC_URL", "-")]
310         [Property("CRITERIA", "MR")]
311         [Property("AUTHOR", "guowei.wang@samsung.com")]
312         public void ItemCollectionCopyToWithArrayIndex()
313         {
314             tlog.Debug(tag, $"ItemCollectionCopyToWithArrayIndex START");
315
316             var testingTarget = new ItemCollection();
317             Assert.IsNotNull(testingTarget, "Should be not null!");
318             Assert.IsInstanceOf<ItemCollection>(testingTarget, "Should be an Instance of ItemCollection!");
319
320             testingTarget.Add(new Item());
321             Assert.AreEqual(1, testingTarget.Count, "Should be equal!");
322
323             try
324             {
325                 testingTarget.CopyTo(new Item[2], 0);
326             }
327             catch (Exception e)
328             {
329                 tlog.Debug(tag, e.Message.ToString());
330                 Assert.Fail("Caught Exception: Failed!");
331             }
332
333             testingTarget.Dispose();
334             tlog.Debug(tag, $"ItemCollectionCopyToWithArrayIndex END (OK)");
335         }
336
337         [Test]
338         [Category("P2")]
339         [Description("ItemCollection CopyTo. With null array.")]
340         [Property("SPEC", "Tizen.NUI.ItemCollection.CopyTo M")]
341         [Property("SPEC_URL", "-")]
342         [Property("CRITERIA", "MR")]
343         [Property("AUTHOR", "guowei.wang@samsung.com")]
344         public void ItemCollectionCopyToWithNullArray()
345         {
346             tlog.Debug(tag, $"ItemCollectionCopyToWithNullArray START");
347
348             var testingTarget = new ItemCollection();
349             Assert.IsNotNull(testingTarget, "Should be not null!");
350             Assert.IsInstanceOf<ItemCollection>(testingTarget, "Should be an Instance of ItemCollection!");
351
352             testingTarget.Add(new Item());
353             Assert.AreEqual(1, testingTarget.Count, "Should be equal!");
354
355             try
356             {
357                 testingTarget.CopyTo(null, 0);
358             }
359             catch (ArgumentNullException e)
360             {
361                 tlog.Debug(tag, e.Message.ToString());
362                 testingTarget.Dispose();
363                 tlog.Debug(tag, $"ItemCollectionCopyToWithNullArray END (OK)");
364                 Assert.Fail("Caught ArgumentNullException: Failed!");
365             }
366         }
367
368         [Test]
369         [Category("P1")]
370         [Description("ItemCollection CopyTo. ArrayIndex < 0.")]
371         [Property("SPEC", "Tizen.NUI.ItemCollection.CopyTo M")]
372         [Property("SPEC_URL", "-")]
373         [Property("CRITERIA", "MR")]
374         [Property("AUTHOR", "guowei.wang@samsung.com")]
375         public void ItemCollectionCopyToWithArrayIndexLessThan0()
376         {
377             tlog.Debug(tag, $"ItemCollectionCopyToWithArrayIndexLessThan0 START");
378
379             var testingTarget = new ItemCollection();
380             Assert.IsNotNull(testingTarget, "Should be not null!");
381             Assert.IsInstanceOf<ItemCollection>(testingTarget, "Should be an Instance of ItemCollection!");
382
383             testingTarget.Add(new Item());
384             Assert.AreEqual(1, testingTarget.Count, "Should be equal!");
385
386             try
387             {
388                 testingTarget.CopyTo(new Item[2], -1);
389             }
390             catch (ArgumentOutOfRangeException e)
391             {
392                 tlog.Debug(tag, e.Message.ToString());
393                 testingTarget.Dispose();
394                 tlog.Debug(tag, $"ItemCollectionCopyToWithArrayIndexLessThan0 END (OK)");
395                 Assert.Fail("Caught ArgumentOutOfRangeException: Failed!");
396             }
397         }
398
399         [Test]
400         [Category("P2")]
401         [Description("ItemCollection CopyTo. Elements too large.")]
402         [Property("SPEC", "Tizen.NUI.ItemCollection.CopyTo M")]
403         [Property("SPEC_URL", "-")]
404         [Property("CRITERIA", "MR")]
405         [Property("AUTHOR", "guowei.wang@samsung.com")]
406         public void ItemCollectionCopyToWithLargerElements()
407         {
408             tlog.Debug(tag, $"ItemCollectionCopyToWithLargerElements START");
409
410             Item[] b = new Item[] { new Item(), new Item(), new Item(), new Item() };
411             global::System.Collections.ICollection c = b;
412             var testingTarget = new ItemCollection(c);
413             Assert.IsNotNull(testingTarget, "Should be not null!");
414             Assert.IsInstanceOf<ItemCollection>(testingTarget, "Should be an Instance of ItemCollection!");
415
416             Item[] array = new Item[4];
417
418             try
419             {
420                 testingTarget.CopyTo(array, 2);
421             }
422             catch (ArgumentException e)
423             {
424                 tlog.Debug(tag, e.Message.ToString());
425                 testingTarget.Dispose();
426                 tlog.Debug(tag, $"ItemCollectionCopyToWithLargerElements END (OK)");
427                 Assert.Fail("Caught ArgumentException: Failed!");
428             }
429         }
430
431         [Test]
432         [Category("P2")]
433         [Description("ItemCollection CopyTo. Index < 0.")]
434         [Property("SPEC", "Tizen.NUI.ItemCollection.CopyTo M")]
435         [Property("SPEC_URL", "-")]
436         [Property("CRITERIA", "MR")]
437         [Property("AUTHOR", "guowei.wang@samsung.com")]
438         public void ItemCollectionCopyToWithIndexLessThan0()
439         {
440             tlog.Debug(tag, $"ItemCollectionCopyToWithIndexLessThan0 START");
441
442             var testingTarget = new ItemCollection();
443             Assert.IsNotNull(testingTarget, "Should be not null!");
444             Assert.IsInstanceOf<ItemCollection>(testingTarget, "Should be an Instance of ItemCollection!");
445
446             testingTarget.Add(new Item());
447             Assert.AreEqual(1, testingTarget.Count, "Should be equal!");
448
449             try
450             {
451                 testingTarget.CopyTo(-1, new Item[2], 0,  1);
452             }
453             catch (ArgumentOutOfRangeException e)
454             {
455                 tlog.Debug(tag, e.Message.ToString());
456                 testingTarget.Dispose();
457                 tlog.Debug(tag, $"ItemCollectionCopyToWithIndexLessThan0 END (OK)");
458                 Assert.Fail("Caught ArgumentOutOfRangeException: Failed!");
459             }
460         }
461
462         [Test]
463         [Category("P2")]
464         [Description("ItemCollection CopyTo. Count < zero.")]
465         [Property("SPEC", "Tizen.NUI.ItemCollection.CopyTo M")]
466         [Property("SPEC_URL", "-")]
467         [Property("CRITERIA", "MR")]
468         [Property("AUTHOR", "guowei.wang@samsung.com")]
469         public void ItemCollectionCopyToWithCountLessThan0()
470         {
471             tlog.Debug(tag, $"ItemCollectionCopyToWithCountLessThan0 START");
472
473             var testingTarget = new ItemCollection();
474             Assert.IsNotNull(testingTarget, "Should be not null!");
475             Assert.IsInstanceOf<ItemCollection>(testingTarget, "Should be an Instance of ItemCollection!");
476
477             testingTarget.Add(new Item());
478             Assert.AreEqual(1, testingTarget.Count, "Should be equal!");
479
480             try
481             {
482                 testingTarget.CopyTo(0, new Item[2], 0, -1);
483             }
484             catch (ArgumentOutOfRangeException e)
485             {
486                 tlog.Debug(tag, e.Message.ToString());
487                 testingTarget.Dispose();
488                 tlog.Debug(tag, $"ItemCollectionCopyToWithCountLessThan0 END (OK)");
489                 Assert.Fail("Caught ArgumentOutOfRangeException: Failed!");
490             }
491         }
492
493         [Test]
494         [Category("P1")]
495         [Description("ItemCollection GetEnumerator.")]
496         [Property("SPEC", "Tizen.NUI.ItemCollection.GetEnumerator M")]
497         [Property("SPEC_URL", "-")]
498         [Property("CRITERIA", "MR")]
499         [Property("AUTHOR", "guowei.wang@samsung.com")]
500         public void ItemCollectionGetEnumerator()
501         {
502             tlog.Debug(tag, $"ItemCollectionGetEnumerator START");
503
504             Item[] b = new Item[] { new Item(), new Item(), new Item(), new Item() };
505             global::System.Collections.ICollection c = b;
506             var testingTarget = new ItemCollection(c);
507             Assert.IsNotNull(testingTarget, "Should be not null!");
508             Assert.IsInstanceOf<ItemCollection>(testingTarget, "Should be an Instance of ItemCollection!");
509
510             var result = testingTarget.GetEnumerator();
511             Assert.IsNotNull(result, "Should be not null!");
512             Assert.IsInstanceOf<ItemCollection.ItemCollectionEnumerator>(result, "Should be an Instance of ItemCollectionEnumerator!");
513
514             tlog.Debug(tag, $"ItemCollectionGetEnumerator END (OK)");
515         }
516
517         [Test]
518         [Category("P1")]
519         [Description("ItemCollection.ItemCollectionEnumerator constructor.")]
520         [Property("SPEC", "Tizen.NUI.ItemCollection.ItemCollectionEnumerator.ItemCollectionEnumerator C")]
521         [Property("SPEC_URL", "-")]
522         [Property("CRITERIA", "CONTSTR")]
523         [Property("AUTHOR", "guowei.wang@samsung.com")]
524         public void ItemCollectionItemCollectionEnumeratorConstructor()
525         {
526             tlog.Debug(tag, $"ItemCollectionItemCollectionEnumeratorConstructor START");
527
528             using (ItemCollection itemCollection = new ItemCollection())
529             {
530                 var testingTarget = new ItemCollection.ItemCollectionEnumerator(itemCollection);
531                 Assert.IsNotNull(testingTarget, "Should be not null!");
532                 Assert.IsInstanceOf<ItemCollection.ItemCollectionEnumerator>(testingTarget, "Should be an Instance of ItemCollectionEnumerator!");
533
534                 testingTarget.Dispose();
535             }
536
537             tlog.Debug(tag, $"ItemCollectionItemCollectionEnumeratorConstructor END (OK)");
538         }
539
540         [Test]
541         [Category("P2")]
542         [Description("ItemCollection.ItemCollectionEnumerator Current. currentIndex == -1.")]
543         [Property("SPEC", "Tizen.NUI.ItemCollection.ItemCollectionEnumerator.Current A")]
544         [Property("SPEC_URL", "-")]
545         [Property("CRITERIA", "PRO")]
546         [Property("AUTHOR", "guowei.wang@samsung.com")]
547         public void ItemCollectionItemCollectionEnumeratorCurrent()
548         {
549             tlog.Debug(tag, $"ItemCollectionItemCollectionEnumeratorCurrent START");
550
551             using (ItemCollection itemCollection = new ItemCollection())
552             {
553                 var testingTarget = new ItemCollection.ItemCollectionEnumerator(itemCollection);
554                 Assert.IsNotNull(testingTarget, "Should be not null!");
555                 Assert.IsInstanceOf<ItemCollection.ItemCollectionEnumerator>(testingTarget, "Should be an Instance of ItemCollectionEnumerator!");
556
557                 try
558                 {
559                     tlog.Debug(tag, "Current : " + testingTarget.Current);
560                 }
561                 catch (InvalidOperationException e)
562                 {
563                     tlog.Debug(tag, e.Message.ToString());
564                     testingTarget.Dispose();
565                     tlog.Debug(tag, $"ItemCollectionItemCollectionEnumeratorCurrent END (OK)");
566                     Assert.Pass("Caught InvalidOperationException : passed!");
567                 }
568             }
569
570             tlog.Debug(tag, $"ItemCollectionItemCollectionEnumeratorCurrent END (OK)");
571         }
572
573         [Test]
574         [Category("P1")]
575         [Description("ItemCollection.ItemCollectionEnumerator MoveNext.")]
576         [Property("SPEC", "Tizen.NUI.ItemCollection.ItemCollectionEnumerator.MoveNext M")]
577         [Property("SPEC_URL", "-")]
578         [Property("CRITERIA", "MR")]
579         [Property("AUTHOR", "guowei.wang@samsung.com")]
580         public void ItemCollectionItemCollectionEnumeratorMoveNext()
581         {
582             tlog.Debug(tag, $"ItemCollectionItemCollectionEnumeratorMoveNext START");
583
584             Item[] b = new Item[] { new Item(), new Item(), new Item(), new Item() };
585             global::System.Collections.ICollection c = b;
586             var itemCollection = new ItemCollection(c);
587             Assert.IsNotNull(itemCollection, "Should be not null!");
588             Assert.IsInstanceOf<ItemCollection>(itemCollection, "Should be an Instance of ItemCollection!");
589
590             var testingTarget = new ItemCollection.ItemCollectionEnumerator(itemCollection);
591             Assert.IsNotNull(testingTarget, "Should be not null!");
592             Assert.IsInstanceOf<ItemCollection.ItemCollectionEnumerator>(testingTarget, "Should be an Instance of ItemCollectionEnumerator!");
593
594             try
595             {
596                 testingTarget.MoveNext();
597                 var result = testingTarget.Current;
598                 Assert.IsNotNull(result, "Should be not null!");
599                 Assert.IsInstanceOf<Item>(result, "Should be an Instance of Item!");
600             }
601             catch (Exception e)
602             {
603                 tlog.Debug(tag, e.Message.ToString());
604                 Assert.Fail("Caught Exception: Failed!");
605             }
606
607             tlog.Debug(tag, $"ItemCollectionItemCollectionEnumeratorMoveNext END (OK)");
608         }
609
610         [Test]
611         [Category("P2")]
612         [Description("ItemCollection.ItemCollectionEnumerator MoveNext. Object is null.")]
613         [Property("SPEC", "Tizen.NUI.ItemCollection.ItemCollectionEnumerator.MoveNext M")]
614         [Property("SPEC_URL", "-")]
615         [Property("CRITERIA", "MR")]
616         [Property("AUTHOR", "guowei.wang@samsung.com")]
617         public void ItemCollectionItemCollectionEnumeratorMoveNextNullObject()
618         {
619             tlog.Debug(tag, $"ItemCollectionItemCollectionEnumeratorMoveNextNullObject START");
620
621             Item[] b = new Item[] { new Item(), new Item(), new Item(), new Item() };
622             global::System.Collections.ICollection c = b;
623             var itemCollection = new ItemCollection(c);
624             Assert.IsNotNull(itemCollection, "Should be not null!");
625             Assert.IsInstanceOf<ItemCollection>(itemCollection, "Should be an Instance of ItemCollection!");
626
627             var testingTarget = new ItemCollection.ItemCollectionEnumerator(itemCollection);
628             Assert.IsNotNull(testingTarget, "Should be not null!");
629             Assert.IsInstanceOf<ItemCollection.ItemCollectionEnumerator>(testingTarget, "Should be an Instance of ItemCollectionEnumerator!");
630
631             try
632             {
633                 testingTarget.MoveNext();
634                 testingTarget.MoveNext();
635                 testingTarget.MoveNext();
636                 testingTarget.MoveNext();
637                 testingTarget.MoveNext();
638                 var result = testingTarget.Current;
639             }
640             catch (InvalidOperationException e)
641             {
642                 tlog.Debug(tag, e.Message.ToString());
643                 testingTarget.Dispose();
644                 tlog.Debug(tag, $"ItemCollectionItemCollectionEnumeratorMoveNextNullObject END (OK)");
645                 Assert.Pass("Caught InvalidOperationException: Passed!");
646             }
647         }
648
649         [Test]
650         [Category("P1")]
651         [Description("ItemCollection.ItemCollectionEnumerator Reset.")]
652         [Property("SPEC", "Tizen.NUI.ItemCollection.ItemCollectionEnumerator.Reset M")]
653         [Property("SPEC_URL", "-")]
654         [Property("CRITERIA", "MR")]
655         [Property("AUTHOR", "guowei.wang@samsung.com")]
656         public void ItemCollectionItemCollectionEnumeratorReset()
657         {
658             tlog.Debug(tag, $"ItemCollectionItemCollectionEnumeratorReset START");
659
660             Item[] b = new Item[] { new Item(), new Item(), new Item(), new Item() };
661             global::System.Collections.ICollection c = b;
662             var itemCollection = new ItemCollection(c);
663             Assert.IsNotNull(itemCollection, "Should be not null!");
664             Assert.IsInstanceOf<ItemCollection>(itemCollection, "Should be an Instance of ItemCollection!");
665
666             var testingTarget = new ItemCollection.ItemCollectionEnumerator(itemCollection);
667             Assert.IsNotNull(testingTarget, "Should be not null!");
668             Assert.IsInstanceOf<ItemCollection.ItemCollectionEnumerator>(testingTarget, "Should be an Instance of ItemCollectionEnumerator!");
669
670             testingTarget.MoveNext();
671
672             try
673             {
674                 testingTarget.Reset();
675             }
676             catch (Exception e)
677             {
678                 tlog.Debug(tag, e.Message.ToString());
679                 Assert.Fail("Caught Exception: Failed!");
680             }
681
682             tlog.Debug(tag, $"ItemCollectionItemCollectionEnumeratorReset END (OK)");
683         }
684
685         [Test]
686         [Category("P1")]
687         [Description("ItemCollection AddRange.")]
688         [Property("SPEC", "Tizen.NUI.ItemCollection.AddRange M")]
689         [Property("SPEC_URL", "-")]
690         [Property("CRITERIA", "MR")]
691         [Property("AUTHOR", "guowei.wang@samsung.com")]
692         public void ItemCollectionAddRange()
693         {
694             tlog.Debug(tag, $"ItemCollectionAddRange START");
695
696             using (ItemCollection itemCollection = new ItemCollection(5))
697             {
698                 var testingTarget = new ItemCollection();
699                 Assert.IsNotNull(testingTarget, "Should be not null!");
700                 Assert.IsInstanceOf<ItemCollection>(testingTarget, "Should be an Instance of ItemCollection!");
701
702                 try
703                 {
704                     testingTarget.AddRange(itemCollection);
705                 }
706                 catch (Exception e)
707                 {
708                     tlog.Debug(tag, e.Message.ToString());
709                     Assert.Fail("Caught Exception: Failed!");
710                 }
711
712                 testingTarget.Dispose();
713             }
714
715             tlog.Debug(tag, $"ItemCollectionAddRange END (OK)");
716         }
717
718         [Test]
719         [Category("P1")]
720         [Description("ItemCollection GetRange.")]
721         [Property("SPEC", "Tizen.NUI.ItemCollection.GetRange M")]
722         [Property("SPEC_URL", "-")]
723         [Property("CRITERIA", "MR")]
724         [Property("AUTHOR", "guowei.wang@samsung.com")]
725         public void ItemCollectionGetRange()
726         {
727             tlog.Debug(tag, $"ItemCollectionGetRange START");
728
729             using (ItemCollection itemCollection = new ItemCollection(5))
730             {
731                 var testingTarget = new ItemCollection();
732                 Assert.IsNotNull(testingTarget, "Should be not null!");
733                 Assert.IsInstanceOf<ItemCollection>(testingTarget, "Should be an Instance of ItemCollection!");
734
735                 testingTarget.AddRange(itemCollection);
736
737                 try
738                 {
739                     var result = testingTarget.GetRange(0, 0);
740                     Assert.IsInstanceOf<ItemCollection>(result, "Should be an Instance of ItemCollection!");
741                 }
742                 catch (Exception e)
743                 {
744                     tlog.Debug(tag, e.Message.ToString());
745                     Assert.Fail("Caught Exception: Failed!");
746                 }
747
748                 testingTarget.Dispose();
749             }
750
751             tlog.Debug(tag, $"ItemCollectionGetRange END (OK)");
752         }
753
754         [Test]
755         [Category("P1")]
756         [Description("ItemCollection Insert.")]
757         [Property("SPEC", "Tizen.NUI.ItemCollection.Insert M")]
758         [Property("SPEC_URL", "-")]
759         [Property("CRITERIA", "MR")]
760         [Property("AUTHOR", "guowei.wang@samsung.com")]
761         public void ItemCollectionInsert()
762         {
763             tlog.Debug(tag, $"ItemCollectionInsert START");
764
765             Item[] b = new Item[] { new Item(), new Item(), new Item(), new Item() };
766             global::System.Collections.ICollection c = b;
767             var testingTarget = new ItemCollection(c);
768
769             testingTarget.Capacity = 5;
770
771             try
772             {
773                 testingTarget.Insert(4, new Item());
774             }
775             catch (Exception e)
776             {
777                 tlog.Debug(tag, e.Message.ToString());
778                 Assert.Fail("Caught Exception: Failed!");
779             }
780
781             testingTarget.Dispose();
782             tlog.Debug(tag, $"ItemCollectionInsert END (OK)");
783         }
784
785         [Test]
786         [Category("P1")]
787         [Description("ItemCollection InsertRange.")]
788         [Property("SPEC", "Tizen.NUI.ItemCollection.InsertRange M")]
789         [Property("SPEC_URL", "-")]
790         [Property("CRITERIA", "MR")]
791         [Property("AUTHOR", "guowei.wang@samsung.com")]
792         public void ItemCollectionInsertRange()
793         {
794             tlog.Debug(tag, $"ItemCollectionInsertRange START");
795
796             using (ItemCollection value = new ItemCollection(3))
797             {
798
799                 Item[] b = new Item[] { new Item(), new Item(), new Item(), new Item() };
800                 global::System.Collections.ICollection c = b;
801                 var testingTarget = new ItemCollection(c);
802
803                 testingTarget.Capacity = 10;
804
805                 try
806                 {
807                     testingTarget.InsertRange(4, value);
808                 }
809                 catch (Exception e)
810                 {
811                     tlog.Debug(tag, e.Message.ToString());
812                     Assert.Fail("Caught Exception: Failed!");
813                 }
814
815                 testingTarget.Dispose();
816             }
817
818             tlog.Debug(tag, $"ItemCollectionInsertRange END (OK)");
819         }
820
821         [Test]
822         [Category("P1")]
823         [Description("ItemCollection RemoveAt.")]
824         [Property("SPEC", "Tizen.NUI.ItemCollection.RemoveAt M")]
825         [Property("SPEC_URL", "-")]
826         [Property("CRITERIA", "MR")]
827         [Property("AUTHOR", "guowei.wang@samsung.com")]
828         public void ItemCollectionRemoveAt()
829         {
830             tlog.Debug(tag, $"ItemCollectionRemoveAt START");
831
832             Item[] b = new Item[] { new Item(), new Item(), new Item(), new Item() };
833             global::System.Collections.ICollection c = b;
834             var testingTarget = new ItemCollection(c);
835
836             testingTarget.Capacity = 5;
837
838             try
839             {
840                 testingTarget.RemoveAt(3);
841             }
842             catch (Exception e)
843             {
844                 tlog.Debug(tag, e.Message.ToString());
845                 Assert.Fail("Caught Exception: Failed!");
846             }
847
848             testingTarget.Dispose();
849
850             tlog.Debug(tag, $"ItemCollectionRemoveAt END (OK)");
851         }
852
853         [Test]
854         [Category("P1")]
855         [Description("ItemCollection RemoveRange.")]
856         [Property("SPEC", "Tizen.NUI.ItemCollection.RemoveRange M")]
857         [Property("SPEC_URL", "-")]
858         [Property("CRITERIA", "MR")]
859         [Property("AUTHOR", "guowei.wang@samsung.com")]
860         public void ItemCollectionRemoveRange()
861         {
862             tlog.Debug(tag, $"ItemCollectionRemoveRange START");
863
864             Item[] b = new Item[] { new Item(), new Item(), new Item(), new Item() };
865             global::System.Collections.ICollection c = b;
866             var testingTarget = new ItemCollection(c);
867
868             testingTarget.Capacity = 5;
869
870             try
871             {
872                 testingTarget.RemoveRange(1, 2);
873             }
874             catch (Exception e)
875             {
876                 tlog.Debug(tag, e.Message.ToString());
877                 Assert.Fail("Caught Exception: Failed!");
878             }
879
880             testingTarget.Dispose();
881
882             tlog.Debug(tag, $"ItemCollectionRemoveRange END (OK)");
883         }
884
885         [Test]
886         [Category("P1")]
887         [Description("ItemCollection Repeat.")]
888         [Property("SPEC", "Tizen.NUI.ItemCollection.Repeat M")]
889         [Property("SPEC_URL", "-")]
890         [Property("CRITERIA", "MR")]
891         [Property("AUTHOR", "guowei.wang@samsung.com")]
892         public void ItemCollectionRepeat()
893         {
894             tlog.Debug(tag, $"ItemCollectionRepeat START");
895
896             var testingTarget = ItemCollection.Repeat(new Item(), 6);
897             Assert.IsNotNull(testingTarget, "Should be not null!");
898             Assert.IsInstanceOf<ItemCollection>(testingTarget, "Should be an Instance of ItemCollection!");
899
900             Assert.AreEqual(6, testingTarget.Capacity, "Should be equal!");
901
902             testingTarget.Dispose();
903
904             tlog.Debug(tag, $"ItemCollectionRepeat END (OK)");
905         }
906
907         [Test]
908         [Category("P1")]
909         [Description("ItemCollection SetRange.")]
910         [Property("SPEC", "Tizen.NUI.ItemCollection.SetRange M")]
911         [Property("SPEC_URL", "-")]
912         [Property("CRITERIA", "MR")]
913         [Property("AUTHOR", "guowei.wang@samsung.com")]
914         public void ItemCollectionSetRange()
915         {
916             tlog.Debug(tag, $"ItemCollectionSetRange START");
917
918             using (ItemCollection itemCollection = new ItemCollection(5))
919             {
920                 Item[] b = new Item[] { new Item(), new Item(), new Item(), new Item() };
921                 global::System.Collections.ICollection c = b;
922                 var testingTarget = new ItemCollection(c);
923
924                 try
925                 {
926                     testingTarget.SetRange(1, itemCollection);
927                 }
928                 catch (Exception e)
929                 {
930                     tlog.Debug(tag, e.Message.ToString());
931                     Assert.Fail("Caught Exception: Failed!");
932                 }
933
934                 testingTarget.Dispose();
935             }
936
937             tlog.Debug(tag, $"ItemCollectionSetRange END (OK)");
938         }
939
940         [Test]
941         [Category("P1")]
942         [Description("ItemCollection Reverse.")]
943         [Property("SPEC", "Tizen.NUI.ItemCollection.Reverse M")]
944         [Property("SPEC_URL", "-")]
945         [Property("CRITERIA", "MR")]
946         [Property("AUTHOR", "guowei.wang@samsung.com")]
947         public void ItemCollectionReverse()
948         {
949             tlog.Debug(tag, $"ItemCollectionReverse START");
950
951             Item[] b = new Item[] { new Item(), new Item(), new Item(), new Item() };
952             global::System.Collections.ICollection c = b;
953             var testingTarget = new ItemCollection(c);
954
955             testingTarget.Capacity = 5;
956
957             try
958             {
959                 testingTarget.Reverse();
960             }
961             catch (Exception e)
962             {
963                 tlog.Debug(tag, e.Message.ToString());
964                 Assert.Fail("Caught Exception: Failed!");
965             }
966
967             testingTarget.Dispose();
968
969             tlog.Debug(tag, $"ItemCollectionReverse END (OK)");
970         }
971
972         [Test]
973         [Category("P1")]
974         [Description("ItemCollection Reverse. With parameters.")]
975         [Property("SPEC", "Tizen.NUI.ItemCollection.Reverse M")]
976         [Property("SPEC_URL", "-")]
977         [Property("CRITERIA", "MR")]
978         [Property("AUTHOR", "guowei.wang@samsung.com")]
979         public void ItemCollectionReverseWithParameters()
980         {
981             tlog.Debug(tag, $"ItemCollectionReverseWithParameters START");
982
983             Item[] b = new Item[] { new Item(), new Item(), new Item(), new Item() };
984             global::System.Collections.ICollection c = b;
985             var testingTarget = new ItemCollection(c);
986
987             testingTarget.Capacity = 5;
988
989             try
990             {
991                 testingTarget.Reverse(1, 2);
992             }
993             catch (Exception e)
994             {
995                 tlog.Debug(tag, e.Message.ToString());
996                 Assert.Fail("Caught Exception: Failed!");
997             }
998
999             testingTarget.Dispose();
1000
1001             tlog.Debug(tag, $"ItemCollectionReverseWithParameters END (OK)");
1002         }
1003     }
1004 }