[NUI] Fix runtime error of xaml testcases
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / public / Xaml / TotalSample / GenericCollections.xaml.cs
1 using System;
2 using System.Collections.ObjectModel;
3 using NUnit.Framework;
4 using Tizen.NUI.BaseComponents;
5 using Tizen.NUI.Binding;
6 using Tizen.NUI.Xaml;
7
8 [assembly: XamlResourceId("Tizen.NUI.Devel.Tests.testcase.public.Xaml.TotalSample.GenericCollections.xaml",
9     "testcase.public.Xaml.TotalSample.GenericCollections.xaml",
10     typeof(global::Tizen.NUI.Devel.Tests.GenericCollections))]
11
12 namespace Tizen.NUI.Devel.Tests
13 {
14         public class AttachedBP
15         {
16                 public static readonly BindableProperty AttachedBPProperty = BindableProperty.CreateAttached (
17                         "AttachedBP",
18                         typeof(GenericCollection),
19                         typeof(AttachedBP),
20                         null);
21
22                 public static GenericCollection GetAttachedBP(BindableObject bindable)
23                 {
24                         throw new NotImplementedException();
25                 }
26         }
27
28         public class GenericCollection : ObservableCollection<object>
29         {
30         }
31
32     [XamlFilePath("testcase\\public\\Xaml\\TotalSample\\GenericCollections.xaml")]
33     [XamlCompilation(XamlCompilationOptions.Compile)]
34     public partial class GenericCollections : View
35         {
36         public TextLabel label0;
37
38         public GenericCollections ()
39                 {
40             global::Tizen.NUI.Xaml.Extensions.LoadFromXaml(this, typeof(GenericCollections));
41             label0 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "label0");
42         }
43
44
45         }
46
47         [TestFixture]
48         public class GenericCollectionsTests
49         {
50                 [SetUp]
51                 public void Setup()
52                 {
53                 }
54
55                 [TearDown]
56                 public void TearDown()
57                 {
58                 }
59
60                 [Test]
61                 [Category("P1")]
62                 [Description("Extensions LoadFromXaml.")]
63                 [Property("SPEC", "Tizen.NUI.Xaml.Extensions.LoadFromXaml M")]
64                 [Property("SPEC_URL", "-")]
65                 [Property("CRITERIA", "MR")]
66                 public void SupportsCrookedGenericScenarios()
67                 {
68                         var p = new GenericCollections();
69                         Assert.AreEqual("Foo", (p.label0.GetValue(AttachedBP.AttachedBPProperty) as GenericCollection)[0]);
70                 }
71         }
72 }