2 using NUnit.Framework.TUnit;
6 namespace Tizen.NUI.Devel.Tests
8 using tlog = Tizen.Log;
11 [Description("internal/Common/Disposable")]
12 public class DisposableTests
14 private const string tag = "NUITEST";
19 Tizen.Log.Info(tag, " Init() is called!");
25 Tizen.Log.Info(tag, " Destroy() is called!");
30 [Description("Create a Disposable object.Check whether object is successfully created or not.")]
31 [Property("SPEC", "Tizen.NUI.Disposable.Disposable C")]
32 [Property("SPEC_URL", "-")]
33 [Property("CRITERIA", "CONSTR")]
34 [Property("AUTHOR", "guowei.wang@samsung.com")]
35 public void Disposable_INIT()
37 tlog.Debug(tag, $"DisposableConstructor START");
39 var disposable = new Disposable();
40 Assert.IsNotNull(disposable, "Can't create success object Disposable");
41 Assert.IsInstanceOf<Disposable>(disposable, "Should be an instance of Disposable type.");
43 tlog.Debug(tag, $"DisposableConstructor END (OK)");
48 [Description("Test Dispose, try to dispose the Disposable.")]
49 [Property("SPEC", "Tizen.NUI.Disposable.Dispose M")]
50 [Property("SPEC_URL", "-")]
51 [Property("CRITERIA", "MCST")]
52 [Property("AUTHOR", "guowei.wang@samsung.com")]
53 public void Dispose_TEST()
55 tlog.Debug(tag, $"DisposableWithDisposable START");
59 Disposable disposable = new Disposable();
64 tlog.Error(tag, "Caught Exception" + e.ToString());
65 Assert.Fail("Caught Exception" + e.ToString());
68 tlog.Debug(tag, $"DisposableWithDisposable END (OK)");
73 [Description("Test Dispose, try to dispose the Disposable.")]
74 [Property("SPEC", "Tizen.NUI.Disposable.Dispose M")]
75 [Property("SPEC_URL", "-")]
76 [Property("CRITERIA", "MCST")]
77 [Property("COVPARAM", "DisposeTypes")]
78 [Property("AUTHOR", "guowei.wang@samsung.com")]
79 public void Dispose_Implicit_TEST_WITH_DISPOSETYPE()
81 tlog.Debug(tag, $"DisposableImplicit START");
85 MyDisposable myDisposable = new MyDisposable();
86 myDisposable.DisposeImplicit();
90 tlog.Error(tag, "Caught Exception" + e.ToString());
91 Assert.Fail("Caught Exception" + e.ToString());
94 tlog.Debug(tag, $"DisposableImplicit END (OK)");
99 [Description("Test Dispose, try to dispose the Disposable.")]
100 [Property("SPEC", "Tizen.NUI.Disposable.Dispose M")]
101 [Property("SPEC_URL", "-")]
102 [Property("CRITERIA", "MCST")]
103 [Property("COVPARAM", "DisposeTypes")]
104 [Property("AUTHOR", "guowei.wang@samsung.com")]
105 public void Dispose_Explicit_TEST_WITH_DISPOSETYPE()
107 tlog.Debug(tag, $"DisposableExplicit START");
111 MyDisposable myDisposable = new MyDisposable();
112 myDisposable.DisposeExplicit();
116 tlog.Error(tag, "Caught Exception" + e.ToString());
117 Assert.Fail("Caught Exception" + e.ToString());
120 tlog.Debug(tag, $"DisposableExplicit END (OK)");
124 public class MyDisposable : Disposable
126 public void DisposeImplicit()
128 Dispose(DisposeTypes.Implicit);
131 public void DisposeExplicit()
133 Dispose(DisposeTypes.Explicit);