[NUI] Add xaml binding testcases
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / public / XamlBinding / TSBindableObjectExtensions.cs
1 using NUnit.Framework;
2 using System;
3 using Tizen.NUI.BaseComponents;
4 using Tizen.NUI.Binding;
5 using Tizen.NUI.Xaml;
6
7 namespace Tizen.NUI.Devel.Tests
8 {
9     using tlog = Tizen.Log;
10
11     [TestFixture]
12     [Description("public/XamlBinding/BindableObjectExtensions")]
13     internal class PublicBindableObjectExtensionsTest
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("BindableObjectExtensions  SetBinding")]
32         [Property("SPEC", "Tizen.NUI.Binding.BindableObjectExtensions.SetBinding  M")]
33         [Property("SPEC_URL", "-")]
34         [Property("CRITERIA", "MCST")]
35         public void SetBindingTest1()
36         {
37             tlog.Debug(tag, $"SetBindingTest1 START");
38             try
39             {
40                 var view = new View();
41                 BindableObjectExtensions.SetBinding(view, View.FocusableProperty, "Focusable");
42             }
43             catch (Exception e)
44             {
45                 Assert.Fail("Caught Exception" + e.ToString());
46             }
47             tlog.Debug(tag, $"SetBindingTest1 END");
48         }
49
50         [Test]
51         [Category("P1")]
52         [Description("BindableObjectExtensions  SetBinding")]
53         [Property("SPEC", "Tizen.NUI.Binding.BindableObjectExtensions.SetBinding  M")]
54         [Property("SPEC_URL", "-")]
55         [Property("CRITERIA", "MCST")]
56         public void SetBindingTest2()
57         {
58             tlog.Debug(tag, $"SetBindingTest2 START");
59
60             var view = new View();
61             Assert.Throws<ArgumentNullException>(() => BindableObjectExtensions.SetBinding(null, View.FocusableProperty, "Focusable"));
62             Assert.Throws<ArgumentNullException>(() => BindableObjectExtensions.SetBinding(view, null, "Focusable"));
63
64             tlog.Debug(tag, $"SetBindingTest2 END");
65         }
66     }
67 }