--- /dev/null
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using Tizen.NUI;
+using Tizen.NUI.Test;
+
+namespace Tizen.NUI.Tests
+{
+ [TestFixture]
+ [Description("Tizen.NUI.Disposable Tests")]
+ public class DisposableTests
+ {
+ private string TAG = "NUI";
+
+ [SetUp]
+ public void Init()
+ {
+ Tizen.Log.Info(TAG, " Init() is called!");
+ App.MainTitleChangeText("DisposableTests");
+ App.MainTitleChangeBackgroundColor(null);
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ Tizen.Log.Info(TAG, " Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Create a Disposable object.Check whether object is successfully created or not.")]
+ [Property("SPEC", "Tizen.NUI.Disposable.Disposable C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")]
+ public void Disposable_INIT()
+ {
+ /* TEST CODE */
+ var disposable = new Disposable();
+
+ Assert.IsNotNull(disposable, "Can't create success object Disposable");
+ Assert.IsInstanceOf<Disposable>(disposable, "Should be an instance of Disposable type.");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Dispose, try to dispose the Disposable.")]
+ [Property("SPEC", "Tizen.NUI.Disposable.Dispose M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")]
+ public void Dispose_TEST()
+ {
+ /* TEST CODE */
+ try
+ {
+ Disposable disposable = new Disposable();
+ disposable.Dispose();
+ }
+ catch (Exception e)
+ {
+ Tizen.Log.Error(TAG, "Caught Exception" + e.ToString());
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Dispose, try to dispose the Disposable.")]
+ [Property("SPEC", "Tizen.NUI.Disposable.Dispose M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("COVPARAM", "DisposeTypes")]
+ [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")]
+ public void Dispose_Implicit_TEST_WITH_DISPOSETYPE()
+ {
+ /* TEST CODE */
+ try
+ {
+ MyDisposable myDisposable = new MyDisposable();
+ myDisposable.DisposeImplicit();
+ }
+ catch (Exception e)
+ {
+ Tizen.Log.Error(TAG, "Caught Exception" + e.ToString());
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Dispose, try to dispose the Disposable.")]
+ [Property("SPEC", "Tizen.NUI.Disposable.Dispose M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("COVPARAM", "DisposeTypes")]
+ [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")]
+ public void Dispose_Explicit_TEST_WITH_DISPOSETYPE()
+ {
+ /* TEST CODE */
+ try
+ {
+ MyDisposable myDisposable = new MyDisposable();
+ myDisposable.DisposeExplicit();
+ }
+ catch (Exception e)
+ {
+ Tizen.Log.Error(TAG, "Caught Exception" + e.ToString());
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ }
+ }
+
+ public class MyDisposable : Disposable
+ {
+ public void DisposeImplicit()
+ {
+ Dispose(DisposeTypes.Implicit);
+ }
+
+ public void DisposeExplicit()
+ {
+ Dispose(DisposeTypes.Explicit);
+ }
+
+ public bool Disposed
+ {
+ get
+ {
+ return disposed;
+ }
+ set
+ {
+ disposed = value;
+ }
+ }
+ }
+}