1 using NUnit.Framework;
6 namespace Tizen.NUI.Devel.Tests
8 using tlog = Tizen.Log;
11 [Description("public/xaml/StaticResourceExtension")]
12 public class PublicStaticResourceExtensionTest
14 private const string tag = "NUITEST";
15 private StaticResourceExtension staticRes;
17 private class ServiceProviderImpl : IServiceProvider
19 private static readonly object service = new object();
21 public object GetService(Type type)
27 private class XmlLineInfoImplent : IXmlLineInfo
29 public int LineNumber => 16;
31 public int LinePosition => 8;
33 public bool HasLineInfo()
42 tlog.Info(tag, "Init() is called!");
43 staticRes = new StaticResourceExtension();
50 tlog.Info(tag, "Destroy() is called!");
55 [Description("StaticResourceExtension Key")]
56 [Property("SPEC", "Tizen.NUI.Xaml.StaticResourceExtension.Key A")]
57 [Property("SPEC_URL", "-")]
58 [Property("CRITERIA", "PRW")]
59 public void StaticResourceExtensionKey()
61 tlog.Debug(tag, $"StaticResourceExtensionKey START");
64 string key = staticRes.Key;
66 Assert.AreEqual(key, staticRes.Key, "Should be equal");
70 tlog.Debug(tag, e.Message.ToString());
71 Assert.Fail("Caught Exception : Failed!");
73 tlog.Debug(tag, $"StaticResourceExtensionKey END");
78 [Description("StaticResourceExtension Key")]
79 [Property("SPEC", "Tizen.NUI.Xaml.StaticResourceExtension.ProvideValue M")]
80 [Property("SPEC_URL", "-")]
81 [Property("CRITERIA", "MR")]
82 public void ProvideValueTest()
84 tlog.Debug(tag, $"ProvideValueTest START");
86 var sr = new StaticResourceExtension();
87 Assert.Throws<ArgumentNullException>(() => sr.ProvideValue(null));
89 tlog.Debug(tag, $"ProvideValueTest END");
94 [Description("StaticResourceExtension ProvideValue")]
95 [Property("SPEC", "Tizen.NUI.Xaml.StaticResourceExtension.ProvideValue M")]
96 [Property("SPEC_URL", "-")]
97 [Property("CRITERIA", "MR")]
98 public void ProvideValueTest2()
100 tlog.Debug(tag, $"ProvideValueTest2 START");
102 var sr = new StaticResourceExtension();
103 Assert.Throws<XamlParseException>(() => sr.ProvideValue(new ServiceProviderImpl()));
105 tlog.Debug(tag, $"ProvideValueTest2 END");
110 [Description("StaticResourceExtension ProvideValue")]
111 [Property("SPEC", "Tizen.NUI.Xaml.StaticResourceExtension.ProvideValue M")]
112 [Property("SPEC_URL", "-")]
113 [Property("CRITERIA", "MR")]
114 public void ProvideValueTest3()
116 tlog.Debug(tag, $"ProvideValueTest3 START");
118 var sr = new StaticResourceExtension();
120 Assert.Throws<ArgumentException>(() => sr.ProvideValue(new ServiceProviderImpl()));
122 tlog.Debug(tag, $"ProvideValueTest3 END");
127 [Description("StaticResourceExtension GetApplicationLevelResource")]
128 [Property("SPEC", "Tizen.NUI.Xaml.StaticResourceExtension.GetApplicationLevelResource M")]
129 [Property("SPEC_URL", "-")]
130 [Property("CRITERIA", "MR")]
131 public void GetApplicationLevelResourceTest()
133 tlog.Debug(tag, $"GetApplicationLevelResourceTest START");
135 var sr = new StaticResourceExtension();
136 Assert.Throws<ArgumentNullException>(() => sr.GetApplicationLevelResource("key", null));
138 tlog.Debug(tag, $"GetApplicationLevelResourceTest END");