[Non-ACR][WatchfaceComplication] Fix null dispose bug 34/222634/2
authorhyunho <hhstark.kang@samsung.com>
Fri, 17 Jan 2020 01:32:13 +0000 (10:32 +0900)
committerhyunho <hhstark.kang@samsung.com>
Fri, 17 Jan 2020 01:45:10 +0000 (10:45 +0900)
Change-Id: I323bed91d5f4675dde36a02d528c0438ddf3bf65
Signed-off-by: hyunho <hhstark.kang@samsung.com>
tct-suite-vs/Tizen.WatchfaceComplication.Tests/testcase/TSComplication.cs

index 7f708d4..126487e 100644 (file)
@@ -39,7 +39,6 @@ namespace Tizen.Applications.WatchfaceComplication.Tests {
         private const string _providerId = "org.tizen.ComplicationProviderCsharp/battery";
         private const string _notExistProviderId = "org.tizen.notexist";
         public static bool _userDisposeCalled;
-        private static MyComplication _mc;
 
         class MyComplication : Complication
         {
@@ -136,7 +135,6 @@ namespace Tizen.Applications.WatchfaceComplication.Tests {
         public void Destroy()
         {
             LogUtils.Write(LogUtils.DEBUG , LogUtils.TAG , "Postconditions for each TEST");
-            _mc.Dispose();
         }
 
         [Test]
@@ -192,14 +190,14 @@ namespace Tizen.Applications.WatchfaceComplication.Tests {
         [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")]
         public void GetCurrentProviderId_Return_Value()
         {
-            _mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText);
-            _mc.SendUpdateRequest();
-            Assert.IsNotNull(_mc, "Object should not be null after initializing");
-            Assert.IsInstanceOf<Complication>(_mc, "Object should be instance of Complication");
-            string providerId = _mc.GetCurrentProviderId();
+            var mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText);
+            mc.SendUpdateRequest();
+            Assert.IsNotNull(mc, "Object should not be null after initializing");
+            Assert.IsInstanceOf<Complication>(mc, "Object should be instance of Complication");
+            string providerId = mc.GetCurrentProviderId();
             Assert.AreEqual(providerId, _providerId);
 
-            _mc.Dispose();
+            mc.Dispose();
         }
 
         [Test]
@@ -211,12 +209,12 @@ namespace Tizen.Applications.WatchfaceComplication.Tests {
         [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")]
         public void GetCurrentType_Return_Value()
         {
-            _mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText);
-            Assert.IsNotNull(_mc, "Object should not be null after initializing");
-            Assert.IsInstanceOf<Complication>(_mc, "Object should be instance of Complication");
-            ComplicationTypes type = _mc.GetCurrentType();
+            var mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText);
+            Assert.IsNotNull(mc, "Object should not be null after initializing");
+            Assert.IsInstanceOf<Complication>(mc, "Object should be instance of Complication");
+            ComplicationTypes type = mc.GetCurrentType();
             Assert.AreEqual(type, ComplicationTypes.ShortText);
-            _mc.Dispose();
+            mc.Dispose();
         }
 
         [Test]
@@ -228,14 +226,14 @@ namespace Tizen.Applications.WatchfaceComplication.Tests {
         [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")]
         public async Task GetExtraData_Return_Value()
         {
-            _mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText);
-            Assert.IsNotNull(_mc, "Object should not be null after initializing");
-            Assert.IsInstanceOf<Complication>(_mc, "Object should be instance of Complication");
+            var mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText);
+            Assert.IsNotNull(mc, "Object should not be null after initializing");
+            Assert.IsInstanceOf<Complication>(mc, "Object should be instance of Complication");
 
-            _mc.SendUpdateRequest();
+            mc.SendUpdateRequest();
             await Task.Delay(15000);
-            Assert.AreNotEqual(_mc._extraData, null);
-            _mc.Dispose();
+            Assert.AreNotEqual(mc._extraData, null);
+            mc.Dispose();
         }
 
         [Test]
@@ -260,14 +258,14 @@ namespace Tizen.Applications.WatchfaceComplication.Tests {
         [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")]
         public async Task GetIconPath_Return_Value()
         {
-            _mc = new MyComplication(_notEditedCompId, ComplicationTypes.Icon, EventTypes.EventTap, _providerId, ComplicationTypes.Icon);
-            Assert.IsNotNull(_mc, "Object should not be null after initializing");
-            Assert.IsInstanceOf<Complication>(_mc, "Object should be instance of Complication");
+            var mc = new MyComplication(_notEditedCompId, ComplicationTypes.Icon, EventTypes.EventTap, _providerId, ComplicationTypes.Icon);
+            Assert.IsNotNull(mc, "Object should not be null after initializing");
+            Assert.IsInstanceOf<Complication>(mc, "Object should be instance of Complication");
 
-            _mc.SendUpdateRequest();
+            mc.SendUpdateRequest();
             await Task.Delay(5000);
-            Assert.AreNotEqual(_mc._iconPath, null);
-            _mc.Dispose();
+            Assert.AreNotEqual(mc._iconPath, null);
+            mc.Dispose();
         }
 
         [Test]
@@ -292,14 +290,14 @@ namespace Tizen.Applications.WatchfaceComplication.Tests {
         [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")]
         public async Task GetImagePath_Return_Value()
         {
-            _mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.Image, EventTypes.EventTap, _providerId, ComplicationTypes.Image);
-            Assert.IsNotNull(_mc, "Object should not be null after initializing");
-            Assert.IsInstanceOf<Complication>(_mc, "Object should be instance of Complication");
+            var mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.Image, EventTypes.EventTap, _providerId, ComplicationTypes.Image);
+            Assert.IsNotNull(mc, "Object should not be null after initializing");
+            Assert.IsInstanceOf<Complication>(mc, "Object should be instance of Complication");
 
-            _mc.SendUpdateRequest();
+            mc.SendUpdateRequest();
             await Task.Delay(5000);
-            Assert.AreNotEqual(_mc._imagePath, null);
-            _mc.Dispose();
+            Assert.AreNotEqual(mc._imagePath, null);
+            mc.Dispose();
         }
 
         [Test]
@@ -324,14 +322,14 @@ namespace Tizen.Applications.WatchfaceComplication.Tests {
         [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")]
         public async Task GetLongText_Return_Value()
         {
-            _mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.LongText, EventTypes.EventTap, _providerId, ComplicationTypes.LongText);
-            Assert.IsNotNull(_mc, "Object should not be null after initializing");
-            Assert.IsInstanceOf<Complication>(_mc, "Object should be instance of Complication");
+            var mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.LongText, EventTypes.EventTap, _providerId, ComplicationTypes.LongText);
+            Assert.IsNotNull(mc, "Object should not be null after initializing");
+            Assert.IsInstanceOf<Complication>(mc, "Object should be instance of Complication");
 
-            _mc.SendUpdateRequest();
+            mc.SendUpdateRequest();
             await Task.Delay(5000);
-            Assert.AreNotEqual(_mc._longtext, null);
-            _mc.Dispose();
+            Assert.AreNotEqual(mc._longtext, null);
+            mc.Dispose();
         }
 
         [Test]
@@ -356,14 +354,14 @@ namespace Tizen.Applications.WatchfaceComplication.Tests {
         [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")]
         public async Task GetCurrentValueOfRange_Return_Value()
         {
-            _mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.RangedValue, EventTypes.EventTap, _providerId, ComplicationTypes.RangedValue);
-            Assert.IsNotNull(_mc, "Object should not be null after initializing");
-            Assert.IsInstanceOf<Complication>(_mc, "Object should be instance of Complication");
+            var mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.RangedValue, EventTypes.EventTap, _providerId, ComplicationTypes.RangedValue);
+            Assert.IsNotNull(mc, "Object should not be null after initializing");
+            Assert.IsInstanceOf<Complication>(mc, "Object should be instance of Complication");
 
-            _mc.SendUpdateRequest();
+            mc.SendUpdateRequest();
             await Task.Delay(5000);
-            Assert.AreEqual(_expectCurRange, _mc._curRange);
-            _mc.Dispose();
+            Assert.AreEqual(_expectCurRange, mc._curRange);
+            mc.Dispose();
         }
 
         [Test]
@@ -388,14 +386,14 @@ namespace Tizen.Applications.WatchfaceComplication.Tests {
         [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")]
         public async Task GetMaxValueOfRange_Return_Value()
         {
-            _mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.RangedValue, EventTypes.EventTap, _providerId, ComplicationTypes.RangedValue);
-            Assert.IsNotNull(_mc, "Object should not be null after initializing");
-            Assert.IsInstanceOf<Complication>(_mc, "Object should be instance of Complication");
+            var mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.RangedValue, EventTypes.EventTap, _providerId, ComplicationTypes.RangedValue);
+            Assert.IsNotNull(mc, "Object should not be null after initializing");
+            Assert.IsInstanceOf<Complication>(mc, "Object should be instance of Complication");
 
-            _mc.SendUpdateRequest();
+            mc.SendUpdateRequest();
             await Task.Delay(5000);
-            Assert.AreEqual(_expectMaxRange, _mc._maxRange);
-            _mc.Dispose();
+            Assert.AreEqual(_expectMaxRange, mc._maxRange);
+            mc.Dispose();
         }
 
         [Test]
@@ -420,14 +418,14 @@ namespace Tizen.Applications.WatchfaceComplication.Tests {
         [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")]
         public async Task GetMinValueOfRange_Return_Value()
         {
-            _mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.RangedValue, EventTypes.EventTap, _providerId, ComplicationTypes.RangedValue);
-            Assert.IsNotNull(_mc, "Object should not be null after initializing");
-            Assert.IsInstanceOf<Complication>(_mc, "Object should be instance of Complication");
+            var mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.RangedValue, EventTypes.EventTap, _providerId, ComplicationTypes.RangedValue);
+            Assert.IsNotNull(mc, "Object should not be null after initializing");
+            Assert.IsInstanceOf<Complication>(mc, "Object should be instance of Complication");
 
-            _mc.SendUpdateRequest();
+            mc.SendUpdateRequest();
             await Task.Delay(5000);
-            Assert.AreEqual(_expectMinRange, _mc._minRange);
-            _mc.Dispose();
+            Assert.AreEqual(_expectMinRange, mc._minRange);
+            mc.Dispose();
         }
 
         [Test]
@@ -452,14 +450,14 @@ namespace Tizen.Applications.WatchfaceComplication.Tests {
         [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")]
         public async Task GetScreenReaderText_Return_Value()
         {
-            _mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.LongText, EventTypes.EventTap, _providerId, ComplicationTypes.LongText);
-            Assert.IsNotNull(_mc, "Object should not be null after initializing");
-            Assert.IsInstanceOf<Complication>(_mc, "Object should be instance of Complication");
+            var mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.LongText, EventTypes.EventTap, _providerId, ComplicationTypes.LongText);
+            Assert.IsNotNull(mc, "Object should not be null after initializing");
+            Assert.IsInstanceOf<Complication>(mc, "Object should be instance of Complication");
 
-            _mc.SendUpdateRequest();
+            mc.SendUpdateRequest();
             await Task.Delay(5000);
-            Assert.AreNotEqual(null, _mc._screenReaderText);
-            _mc.Dispose();
+            Assert.AreNotEqual(null, mc._screenReaderText);
+            mc.Dispose();
         }
 
         [Test]
@@ -484,14 +482,14 @@ namespace Tizen.Applications.WatchfaceComplication.Tests {
         [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")]
         public async Task GetShortText_Return_Value()
         {
-            _mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.LongText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText);
-            Assert.IsNotNull(_mc, "Object should not be null after initializing");
-            Assert.IsInstanceOf<Complication>(_mc, "Object should be instance of Complication");
+            var mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.LongText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText);
+            Assert.IsNotNull(mc, "Object should not be null after initializing");
+            Assert.IsInstanceOf<Complication>(mc, "Object should be instance of Complication");
 
-            _mc.SendUpdateRequest();
+            mc.SendUpdateRequest();
             await Task.Delay(5000);
-            Assert.AreNotEqual(null, _mc._shorttext);
-            _mc.Dispose();
+            Assert.AreNotEqual(null, mc._shorttext);
+            mc.Dispose();
         }
 
         [Test]
@@ -516,14 +514,14 @@ namespace Tizen.Applications.WatchfaceComplication.Tests {
         [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")]
         public async Task GetTimestamp_Return_Value()
         {
-            _mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.Time, EventTypes.EventTap, _providerId, ComplicationTypes.Time);
-            Assert.IsNotNull(_mc, "Object should not be null after initializing");
-            Assert.IsInstanceOf<Complication>(_mc, "Object should be instance of Complication");
+            var mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.Time, EventTypes.EventTap, _providerId, ComplicationTypes.Time);
+            Assert.IsNotNull(mc, "Object should not be null after initializing");
+            Assert.IsInstanceOf<Complication>(mc, "Object should be instance of Complication");
 
-            _mc.SendUpdateRequest();
+            mc.SendUpdateRequest();
             await Task.Delay(5000);
-            Assert.AreEqual(_expectTimestamp, _mc._timestamp);
-            _mc.Dispose();
+            Assert.AreEqual(_expectTimestamp, mc._timestamp);
+            mc.Dispose();
         }
 
 
@@ -549,14 +547,14 @@ namespace Tizen.Applications.WatchfaceComplication.Tests {
         [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")]
         public async Task GetTitle_Return_Value()
         {
-            _mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.LongText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText);
-            Assert.IsNotNull(_mc, "Object should not be null after initializing");
-            Assert.IsInstanceOf<Complication>(_mc, "Object should be instance of Complication");
+            var mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.LongText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText);
+            Assert.IsNotNull(mc, "Object should not be null after initializing");
+            Assert.IsInstanceOf<Complication>(mc, "Object should be instance of Complication");
 
-            _mc.SendUpdateRequest();
+            mc.SendUpdateRequest();
             await Task.Delay(5000);
-            Assert.AreNotEqual(null, _mc._title);
-            _mc.Dispose();
+            Assert.AreNotEqual(null, mc._title);
+            mc.Dispose();
         }
 
         [Test]
@@ -581,14 +579,14 @@ namespace Tizen.Applications.WatchfaceComplication.Tests {
         [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")]
         public async Task GetType_Return_Value()
         {
-            _mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.LongText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText);
-            Assert.IsNotNull(_mc, "Object should not be null after initializing");
-            Assert.IsInstanceOf<Complication>(_mc, "Object should be instance of Complication");
+            var mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.LongText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText);
+            Assert.IsNotNull(mc, "Object should not be null after initializing");
+            Assert.IsInstanceOf<Complication>(mc, "Object should be instance of Complication");
 
-            _mc.SendUpdateRequest();
+            mc.SendUpdateRequest();
             await Task.Delay(5000);
-            Assert.AreEqual(ComplicationTypes.ShortText, _mc._curDataType);
-            _mc.Dispose();
+            Assert.AreEqual(ComplicationTypes.ShortText, mc._curDataType);
+            mc.Dispose();
         }
 
         [Test]
@@ -613,14 +611,14 @@ namespace Tizen.Applications.WatchfaceComplication.Tests {
         [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")]
         public async Task OnComplicationError_RECEIVE_EVENT()
         {
-            _mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.LongText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText);
-            Assert.IsNotNull(_mc, "Object should not be null after initializing");
-            Assert.IsInstanceOf<Complication>(_mc, "Object should be instance of Complication");
+            var mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.LongText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText);
+            Assert.IsNotNull(mc, "Object should not be null after initializing");
+            Assert.IsInstanceOf<Complication>(mc, "Object should be instance of Complication");
 
-            _mc.SendUpdateRequest();
+            mc.SendUpdateRequest();
             await Task.Delay(5000);
-            Assert.AreEqual(true, _mc._onErrorHit);
-            _mc.Dispose();
+            Assert.AreEqual(true, mc._onErrorHit);
+            mc.Dispose();
         }
 
         [Test]
@@ -632,14 +630,14 @@ namespace Tizen.Applications.WatchfaceComplication.Tests {
         [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")]
         public async Task OnComplicationUpdated_RECEIVE_EVENT()
         {
-            _mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.LongText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText);
-            Assert.IsNotNull(_mc, "Object should not be null after initializing");
-            Assert.IsInstanceOf<Complication>(_mc, "Object should be instance of Complication");
+            var mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.LongText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText);
+            Assert.IsNotNull(mc, "Object should not be null after initializing");
+            Assert.IsInstanceOf<Complication>(mc, "Object should be instance of Complication");
 
-            _mc.SendUpdateRequest();
+            mc.SendUpdateRequest();
             await Task.Delay(5000);
-            Assert.AreNotEqual(null, _mc._shorttext);
-            _mc.Dispose();
+            Assert.AreNotEqual(null, mc._shorttext);
+            mc.Dispose();
         }
 
         [Test]
@@ -651,15 +649,15 @@ namespace Tizen.Applications.WatchfaceComplication.Tests {
         [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")]
         public async Task SendUpdateRequest_SEND()
         {
-            _mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.LongText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText);
-            Assert.IsNotNull(_mc, "Object should not be null after initializing");
-            Assert.IsInstanceOf<Complication>(_mc, "Object should be instance of Complication");
+            var mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.LongText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText);
+            Assert.IsNotNull(mc, "Object should not be null after initializing");
+            Assert.IsInstanceOf<Complication>(mc, "Object should be instance of Complication");
 
             try
             {
-                _mc.SendUpdateRequest();
+                mc.SendUpdateRequest();
                 await Task.Delay(5000);
-                Assert.AreNotEqual(null, _mc._shorttext);
+                Assert.AreNotEqual(null, mc._shorttext);
             }
             catch (Exception e)
             {
@@ -667,7 +665,7 @@ namespace Tizen.Applications.WatchfaceComplication.Tests {
             }
             finally
             {
-                _mc.Dispose();
+                mc.Dispose();
             }
         }
 
@@ -680,12 +678,12 @@ namespace Tizen.Applications.WatchfaceComplication.Tests {
         [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")]
         public void SendUpdateRequest_InvalidOperationException()
         {
-            _mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.LongText, EventTypes.EventTap, "aaa", ComplicationTypes.ShortText);
-            Assert.IsNotNull(_mc, "Object should not be null after initializing");
-            Assert.IsInstanceOf<Complication>(_mc, "Object should be instance of Complication");
+            var mc = new MyComplication(_notEditedCompId, ComplicationTypes.ShortText | ComplicationTypes.LongText, EventTypes.EventTap, "aaa", ComplicationTypes.ShortText);
+            Assert.IsNotNull(mc, "Object should not be null after initializing");
+            Assert.IsInstanceOf<Complication>(mc, "Object should be instance of Complication");
 
-            Assert.Throws<InvalidOperationException>(() => _mc.SendUpdateRequest());
-            _mc.Dispose();
+            Assert.Throws<InvalidOperationException>(() => mc.SendUpdateRequest());
+            mc.Dispose();
         }
 
         [Test]
@@ -698,14 +696,14 @@ namespace Tizen.Applications.WatchfaceComplication.Tests {
         [Property("COVPARAM", "Tizen.Applications.WatchfaceComplication.EventTypes")]
         public void TransferEvent_SEND()
         {
-            _mc = new MyComplication(_compId, ComplicationTypes.ShortText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText);
-            Assert.IsNotNull(_mc, "Object should not be null after initializing");
-            Assert.IsInstanceOf<Complication>(_mc, "Object should be instance of Complication");
+            var mc = new MyComplication(_compId, ComplicationTypes.ShortText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText);
+            Assert.IsNotNull(mc, "Object should not be null after initializing");
+            Assert.IsInstanceOf<Complication>(mc, "Object should be instance of Complication");
 
             try
             {
                 Log.Debug("[TCT]", "[TransferEvent] ");
-                _mc.TransferEvent(EventTypes.EventTap);
+                mc.TransferEvent(EventTypes.EventTap);
             }
             catch (Exception e)
             {
@@ -713,7 +711,7 @@ namespace Tizen.Applications.WatchfaceComplication.Tests {
             }
             finally
             {
-                _mc.Dispose();
+                mc.Dispose();
             }
         }
 
@@ -727,10 +725,10 @@ namespace Tizen.Applications.WatchfaceComplication.Tests {
         [Property("COVPARAM", "Tizen.Applications.WatchfaceComplication.EventTypes")]
         public void TransferEvent_InvalidOperationException()
         {
-            _mc = new MyComplication(_compId, ComplicationTypes.ShortText, EventTypes.EventTap, "aaa", ComplicationTypes.ShortText);
-            Assert.IsNotNull(_mc, "Object should not be null after initializing");
-            Assert.IsInstanceOf<Complication>(_mc, "Object should be instance of Complication");
-            Assert.Throws<InvalidOperationException>(() => _mc.TransferEvent(EventTypes.EventTap));
+            var mc = new MyComplication(_compId, ComplicationTypes.ShortText, EventTypes.EventTap, "aaa", ComplicationTypes.ShortText);
+            Assert.IsNotNull(mc, "Object should not be null after initializing");
+            Assert.IsInstanceOf<Complication>(mc, "Object should be instance of Complication");
+            Assert.Throws<InvalidOperationException>(() => mc.TransferEvent(EventTypes.EventTap));
         }
 
         [Test]
@@ -742,9 +740,9 @@ namespace Tizen.Applications.WatchfaceComplication.Tests {
         [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")]
         public void AllowedList_Return_Value()
         {
-            _mc = new MyComplication(_compId, ComplicationTypes.ShortText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText);
-            Assert.IsNotNull(_mc, "Object should not be null after initializing");
-            Assert.IsInstanceOf<Complication>(_mc, "Object should be instance of Complication");
+            var mc = new MyComplication(_compId, ComplicationTypes.ShortText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText);
+            Assert.IsNotNull(mc, "Object should not be null after initializing");
+            Assert.IsInstanceOf<Complication>(mc, "Object should be instance of Complication");
 
             try
             {
@@ -752,7 +750,7 @@ namespace Tizen.Applications.WatchfaceComplication.Tests {
 
                 List<(string providerId, ComplicationTypes t)> allowedList = new List<(string providerId, ComplicationTypes t)>();
                 allowedList.Add((_providerId, ComplicationTypes.ShortText));
-                _mc.AllowedList = allowedList;
+                mc.AllowedList = allowedList;
             }
             catch (Exception e)
             {
@@ -760,7 +758,7 @@ namespace Tizen.Applications.WatchfaceComplication.Tests {
             }
             finally
             {
-                _mc.Dispose();
+                mc.Dispose();
             }
         }
 
@@ -773,13 +771,13 @@ namespace Tizen.Applications.WatchfaceComplication.Tests {
         [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")]
         public void ComplicationId_Return_Value()
         {
-            _mc = new MyComplication(_compId, ComplicationTypes.ShortText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText);
-            Assert.IsNotNull(_mc, "Object should not be null after initializing");
-            Assert.IsInstanceOf<Complication>(_mc, "Object should be instance of Complication");
+            var mc = new MyComplication(_compId, ComplicationTypes.ShortText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText);
+            Assert.IsNotNull(mc, "Object should not be null after initializing");
+            Assert.IsInstanceOf<Complication>(mc, "Object should be instance of Complication");
 
             try
             {
-                Assert.AreEqual(_compId, _mc.ComplicationId);
+                Assert.AreEqual(_compId, mc.ComplicationId);
             }
             catch (Exception e)
             {
@@ -787,7 +785,7 @@ namespace Tizen.Applications.WatchfaceComplication.Tests {
             }
             finally
             {
-                _mc.Dispose();
+                mc.Dispose();
             }
         }
 
@@ -800,19 +798,19 @@ namespace Tizen.Applications.WatchfaceComplication.Tests {
         [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")]
         public void Highlight_Return_Value()
         {
-            _mc = new MyComplication(_compId, ComplicationTypes.ShortText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText);
-            Assert.IsNotNull(_mc, "Object should not be null after initializing");
-            Assert.IsInstanceOf<Complication>(_mc, "Object should be instance of Complication");
+            var mc = new MyComplication(_compId, ComplicationTypes.ShortText, EventTypes.EventTap, _providerId, ComplicationTypes.ShortText);
+            Assert.IsNotNull(mc, "Object should not be null after initializing");
+            Assert.IsInstanceOf<Complication>(mc, "Object should be instance of Complication");
 
             try
             {
-                _mc.Highlight = new Highlight(ShapeType.Rectangle, 1, 2, 3, 4);
-                Assert.IsNotNull(_mc.Highlight, "Object should not be null after initializing");
-                Assert.AreEqual(ShapeType.Rectangle, _mc.Highlight.ShapeType);
-                Assert.AreEqual(1, _mc.Highlight.X);
-                Assert.AreEqual(2, _mc.Highlight.Y);
-                Assert.AreEqual(3, _mc.Highlight.W);
-                Assert.AreEqual(4, _mc.Highlight.H);
+                mc.Highlight = new Highlight(ShapeType.Rectangle, 1, 2, 3, 4);
+                Assert.IsNotNull(mc.Highlight, "Object should not be null after initializing");
+                Assert.AreEqual(ShapeType.Rectangle, mc.Highlight.ShapeType);
+                Assert.AreEqual(1, mc.Highlight.X);
+                Assert.AreEqual(2, mc.Highlight.Y);
+                Assert.AreEqual(3, mc.Highlight.W);
+                Assert.AreEqual(4, mc.Highlight.H);
             }
             catch (Exception e)
             {
@@ -820,7 +818,7 @@ namespace Tizen.Applications.WatchfaceComplication.Tests {
             }
             finally
             {
-                _mc.Dispose();
+                mc.Dispose();
             }
         }
 
@@ -833,12 +831,12 @@ namespace Tizen.Applications.WatchfaceComplication.Tests {
         [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")]
         public void SupportEvents_Return_Value()
         {
-            _mc = new MyComplication(_compId, ComplicationTypes.ShortText, EventTypes.EventDoubleTap, _providerId, ComplicationTypes.ShortText);
-            Assert.IsNotNull(_mc, "Object should not be null after initializing");
-            Assert.IsInstanceOf<Complication>(_mc, "Object should be instance of Complication");
-            Assert.AreEqual(_mc.SupportEvents, EventTypes.EventDoubleTap);
+            var mc = new MyComplication(_compId, ComplicationTypes.ShortText, EventTypes.EventDoubleTap, _providerId, ComplicationTypes.ShortText);
+            Assert.IsNotNull(mc, "Object should not be null after initializing");
+            Assert.IsInstanceOf<Complication>(mc, "Object should be instance of Complication");
+            Assert.AreEqual(mc.SupportEvents, EventTypes.EventDoubleTap);
 
-            _mc.Dispose();
+            mc.Dispose();
         }
 
         [Test]
@@ -850,13 +848,13 @@ namespace Tizen.Applications.WatchfaceComplication.Tests {
         [Property("AUTHOR", "Hyunho Kang, hhstark.kang@samsung.com")]
         public void SupportTypes_Return_Value()
         {
-            _mc = new MyComplication(_compId, ComplicationTypes.ShortText | ComplicationTypes.Image | ComplicationTypes.LongText,
+            var mc = new MyComplication(_compId, ComplicationTypes.ShortText | ComplicationTypes.Image | ComplicationTypes.LongText,
                 EventTypes.EventDoubleTap, _providerId, ComplicationTypes.ShortText);
-            Assert.IsNotNull(_mc, "Object should not be null after initializing");
-            Assert.IsInstanceOf<Complication>(_mc, "Object should be instance of Complication");
-            Assert.AreEqual(_mc.SupportTypes, ComplicationTypes.ShortText | ComplicationTypes.Image | ComplicationTypes.LongText);
+            Assert.IsNotNull(mc, "Object should not be null after initializing");
+            Assert.IsInstanceOf<Complication>(mc, "Object should be instance of Complication");
+            Assert.AreEqual(mc.SupportTypes, ComplicationTypes.ShortText | ComplicationTypes.Image | ComplicationTypes.LongText);
 
-            _mc.Dispose();
+            mc.Dispose();
         }
     }
 }
\ No newline at end of file