[Tizen.MachineLearning.Inference][TCSACR-300] Add TCs for new Pipeline API 56/229156/6
authorJaeyun <jy1210.jung@samsung.com>
Wed, 8 Apr 2020 02:30:34 +0000 (11:30 +0900)
committerJaeyun <jy1210.jung@samsung.com>
Wed, 8 Apr 2020 03:51:02 +0000 (12:51 +0900)
Add testcases for new Pipeline API.
ML Pipeline API provides functions to create stream pipeline and to handle stream flow.

Change-Id: Ia4ee6e654a868aac3f53289dfa92d0ad76dd5635
Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
tct-suite-vs/Tizen.MachineLearning.Inference.Tests/testcase/TSDataReceivedEventArgs.cs [new file with mode: 0644]
tct-suite-vs/Tizen.MachineLearning.Inference.Tests/testcase/TSPipeline.NodeInfo.cs [new file with mode: 0644]
tct-suite-vs/Tizen.MachineLearning.Inference.Tests/testcase/TSPipeline.SinkNode.cs [new file with mode: 0644]
tct-suite-vs/Tizen.MachineLearning.Inference.Tests/testcase/TSPipeline.SourceNode.cs [new file with mode: 0644]
tct-suite-vs/Tizen.MachineLearning.Inference.Tests/testcase/TSPipeline.SwitchNode.cs [new file with mode: 0644]
tct-suite-vs/Tizen.MachineLearning.Inference.Tests/testcase/TSPipeline.ValveNode.cs [new file with mode: 0644]
tct-suite-vs/Tizen.MachineLearning.Inference.Tests/testcase/TSPipeline.cs [new file with mode: 0644]
tct-suite-vs/Tizen.MachineLearning.Inference.Tests/testcase/TSStateChangedEventArgs.cs [new file with mode: 0644]

diff --git a/tct-suite-vs/Tizen.MachineLearning.Inference.Tests/testcase/TSDataReceivedEventArgs.cs b/tct-suite-vs/Tizen.MachineLearning.Inference.Tests/testcase/TSDataReceivedEventArgs.cs
new file mode 100644 (file)
index 0000000..96a89fe
--- /dev/null
@@ -0,0 +1,155 @@
+/*
+ *  Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License
+ */
+
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using System.IO;
+using Tizen;
+using Tizen.System;
+using Tizen.MachineLearning.Inference;
+using System.Threading.Tasks;
+
+namespace Tizen.MachineLearning.Inference.Tests {
+    [TestFixture]
+    [Description("Tizen.MachineLearning.Inference.DataReceivedEventArgs Tests")]
+    public class DataReceivedEventArgsTests
+    {
+        private const string TAG = "Tizen.MachineLearning.Inference.Tests";
+        private const string FeatureKey = "http://tizen.org/feature/machine_learning.inference";
+        private const int SleepTime = 1000; // default sleep time to run the pipeline
+
+        private readonly string _appsrcPipeline = "appsrc name=srcx ! other/tensor,dimension=(string)4:1:1:1,type=(string)uint8,framerate=(fraction)0/1 ! tensor_sink name=sinkx";
+        private TensorsData _dataReceived;
+        private bool _isMachineLeanringInferenceSupported = false;
+
+        [SetUp]
+        public void Init()
+        {
+            LogUtils.Write(LogUtils.DEBUG, TAG, "Preconditions for Tizen.MachineLearning.Inference TEST");
+
+            Information.TryGetValue(FeatureKey, out _isMachineLeanringInferenceSupported);
+
+            if (!_isMachineLeanringInferenceSupported)
+            {
+                LogUtils.Write(LogUtils.DEBUG, TAG, "ML feature is not supported.");
+            }
+
+            _dataReceived = null;
+        }
+
+        [TearDown]
+        public void Destroy()
+        {
+            LogUtils.Write(LogUtils.DEBUG, TAG, "Postconditions for Tizen.MachineLearning.Inference TEST");
+
+            if (_isMachineLeanringInferenceSupported)
+            {
+                /* release if any res initialized */
+            }
+        }
+
+        private void DataReceivedEvent(object sender, DataReceivedEventArgs args)
+        {
+            Assert.IsNotNull(args, "Failed, EventArgs is null.");
+            _dataReceived = args.Data;
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test Data in DataReceivedEventArgs")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.DataReceivedEventArgs.Data A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRO")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public async Task Data_Get()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create a pipeline instance and start
+                 * - Get source and sink node handle
+                 * - Subscribe the data received event
+                 * - Create tensors data
+                 */
+                int retryCnt = 0;
+                byte[] byte_array = new byte[4] { 1, 2, 3, 4 };
+
+                var pipeline_handle = new Pipeline(_appsrcPipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                var src_handle = pipeline_handle.GetSource("srcx");
+                Assert.IsNotNull(src_handle, "Failed to create source node instance");
+                Assert.IsInstanceOf<Pipeline.SourceNode>(src_handle, "Should return source node instance");
+
+                var in_info = new TensorsInfo();
+                Assert.IsNotNull(in_info, "Failed to create TensorsInfo instance");
+                Assert.IsInstanceOf<TensorsInfo>(in_info, "Should return TensorsInfo instance");
+                in_info.AddTensorInfo(TensorType.UInt8, new int[4] { 4, 1, 1, 1 });
+
+                var in_data = in_info.GetTensorsData();
+                Assert.IsNotNull(in_data, "Failed to create TensorsData instance");
+                Assert.IsInstanceOf<TensorsData>(in_data, "Should return TensorsData instance");
+
+                in_data.SetTensorData(0, byte_array);
+
+                var sink_handle = pipeline_handle.GetSink("sinkx");
+                Assert.IsNotNull(sink_handle, "Failed to create sink node instance");
+                Assert.IsInstanceOf<Pipeline.SinkNode>(sink_handle, "Should return sink node instance");
+
+                /* TEST CODE */
+                sink_handle.DataReceived += DataReceivedEvent;
+
+                pipeline_handle.Start();
+                await Task.Delay(SleepTime);
+
+                src_handle.Input(in_data);
+                while (_dataReceived == null && retryCnt < 20)
+                {
+                    await Task.Delay(SleepTime);
+                    retryCnt++;
+                }
+
+                Assert.IsNotNull(_dataReceived, "Failed to get data from sink node");
+
+                byte[] out_buffer = _dataReceived.GetTensorData(0);
+
+                /* validate passed data */
+                Assert.IsTrue(out_buffer[0] == 1);
+                Assert.IsTrue(out_buffer[1] == 2);
+                Assert.IsTrue(out_buffer[2] == 3);
+                Assert.IsTrue(out_buffer[3] == 4);
+
+                sink_handle.DataReceived -= DataReceivedEvent;
+                pipeline_handle.Dispose();
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else
+                {
+                    Assert.IsTrue(false, e.Message);
+                }
+            }
+        }
+    }
+}
diff --git a/tct-suite-vs/Tizen.MachineLearning.Inference.Tests/testcase/TSPipeline.NodeInfo.cs b/tct-suite-vs/Tizen.MachineLearning.Inference.Tests/testcase/TSPipeline.NodeInfo.cs
new file mode 100644 (file)
index 0000000..443b026
--- /dev/null
@@ -0,0 +1,194 @@
+/*
+ *  Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License
+ */
+
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using System.IO;
+using Tizen;
+using Tizen.System;
+using Tizen.MachineLearning.Inference;
+using System.Threading.Tasks;
+
+namespace Tizen.MachineLearning.Inference.Tests {
+    [TestFixture]
+    [Description("Tizen.MachineLearning.Inference.Pipeline.NodeInfo Tests")]
+    public class PipelineNodeInfoTests
+    {
+        private const string TAG = "Tizen.MachineLearning.Inference.Tests";
+        private const string FeatureKey = "http://tizen.org/feature/machine_learning.inference";
+        private const int SleepTime = 1000; // default sleep time to run the pipeline
+
+        private readonly string _generalPipeline = "videotestsrc is-live=true ! videoconvert ! valve name=valvex ! tensor_converter ! tensor_sink name=sinkx async=false";
+        private readonly string _appsrcPipeline = "appsrc name=srcx ! other/tensor,dimension=(string)4:1:1:1,type=(string)uint8,framerate=(fraction)0/1 ! tensor_sink name=sinkx";
+        private readonly string _valvePipeline = "videotestsrc is-live=true ! videoconvert ! valve name=valvex ! tensor_converter ! tensor_sink name=sinkx";
+        private bool _isMachineLeanringInferenceSupported = false;
+
+        [SetUp]
+        public void Init()
+        {
+            LogUtils.Write(LogUtils.DEBUG, TAG, "Preconditions for Tizen.MachineLearning.Inference TEST");
+
+            Information.TryGetValue(FeatureKey, out _isMachineLeanringInferenceSupported);
+
+            if (!_isMachineLeanringInferenceSupported)
+            {
+                LogUtils.Write(LogUtils.DEBUG, TAG, "ML feature is not supported.");
+            }
+        }
+
+        [TearDown]
+        public void Destroy()
+        {
+            LogUtils.Write(LogUtils.DEBUG, TAG, "Postconditions for Tizen.MachineLearning.Inference TEST");
+
+            if (_isMachineLeanringInferenceSupported)
+            {
+                /* release if any res initialized */
+            }
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Check NodeInfo.Name after getting a sink node handle")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.NodeInfo.Name A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRO")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public void Name_Get()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create a pipeline instance and start
+                 * - Get sink handle
+                 */
+                var pipeline_handle = new Pipeline(_generalPipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                var sink_handle = pipeline_handle.GetSink("sinkx");
+                Assert.IsNotNull(sink_handle, "Failed to create sink node instance");
+                Assert.IsInstanceOf<Pipeline.SinkNode>(sink_handle, "Should return sink node instance");
+
+                /* TEST CODE */
+                Assert.IsTrue(sink_handle.Name == "sinkx");
+
+                pipeline_handle.Dispose();
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else
+                {
+                    Assert.IsTrue(false, e.Message);
+                }
+            }
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Check NodeInfo.Type after getting a source node handle")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.NodeInfo.Type A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRO")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public void Type_Get()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create instance and start the pipeline
+                 * - Get source handle
+                 */
+                var pipeline_handle = new Pipeline(_appsrcPipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                var src_handle = pipeline_handle.GetSource("srcx");
+                Assert.IsNotNull(src_handle, "Failed to create source node instance");
+                Assert.IsInstanceOf<Pipeline.SourceNode>(src_handle, "Should return source node instance");
+
+                /* TEST CODE */
+                Assert.IsTrue(src_handle.Type == Pipeline.NodeType.Source);
+
+                pipeline_handle.Dispose();
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else
+                {
+                    Assert.IsTrue(false, e.Message);
+                }
+            }
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Check NodeInfo.Valid after getting a valve node handle")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.NodeInfo.Valid A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRO")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public void Valid_Get()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create a pipeline instance and start
+                 * - Get the valve node handle
+                 */
+                var pipeline_handle = new Pipeline(_valvePipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                var valve_handle = pipeline_handle.GetValve("valvex");
+                Assert.IsNotNull(valve_handle, "Failed to create valve node instance");
+                Assert.IsInstanceOf<Pipeline.ValveNode>(valve_handle, "Should return valve node instance");
+
+                /* TEST CODE */
+                Assert.IsTrue(valve_handle.Valid == true);
+
+                pipeline_handle.Dispose();
+                Assert.IsTrue(valve_handle.Valid == false);
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else
+                {
+                    Assert.IsTrue(false, e.Message);
+                }
+            }
+        }
+    }
+}
diff --git a/tct-suite-vs/Tizen.MachineLearning.Inference.Tests/testcase/TSPipeline.SinkNode.cs b/tct-suite-vs/Tizen.MachineLearning.Inference.Tests/testcase/TSPipeline.SinkNode.cs
new file mode 100644 (file)
index 0000000..c6de589
--- /dev/null
@@ -0,0 +1,358 @@
+/*
+ *  Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License
+ */
+
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using System.IO;
+using Tizen;
+using Tizen.System;
+using Tizen.MachineLearning.Inference;
+using System.Threading.Tasks;
+
+namespace Tizen.MachineLearning.Inference.Tests {
+    [TestFixture]
+    [Description("Tizen.MachineLearning.Inference.Pipeline.SinkNode Tests")]
+    public class PipelineSinkNodeTests
+    {
+        private const string TAG = "Tizen.MachineLearning.Inference.Tests";
+        private const string FeatureKey = "http://tizen.org/feature/machine_learning.inference";
+        private const int SleepTime = 1000; // default sleep time to run the pipeline
+
+        private readonly string _generalPipeline = "videotestsrc is-live=true ! videoconvert ! valve name=valvex ! tensor_converter ! tensor_sink name=sinkx async=false";
+        private int _countReceivedSinkx;
+        private int _countReceivedSink1;
+        private int _countReceivedSink2;
+        private bool _isMachineLeanringInferenceSupported = false;
+
+        [SetUp]
+        public void Init()
+        {
+            LogUtils.Write(LogUtils.DEBUG, TAG, "Preconditions for Tizen.MachineLearning.Inference TEST");
+
+            Information.TryGetValue(FeatureKey, out _isMachineLeanringInferenceSupported);
+
+            if (!_isMachineLeanringInferenceSupported)
+            {
+                LogUtils.Write(LogUtils.DEBUG, TAG, "ML feature is not supported.");
+            }
+
+            _countReceivedSinkx = 0;
+            _countReceivedSink1 = 0;
+            _countReceivedSink2 = 0;
+        }
+
+        [TearDown]
+        public void Destroy()
+        {
+            LogUtils.Write(LogUtils.DEBUG, TAG, "Postconditions for Tizen.MachineLearning.Inference TEST");
+
+            if (_isMachineLeanringInferenceSupported)
+            {
+                /* release if any res initialized */
+            }
+        }
+
+        private void SinkxDataReceived(object sender, DataReceivedEventArgs args)
+        {
+            _countReceivedSinkx++;
+        }
+
+        private void Sink1DataReceived(object sender, DataReceivedEventArgs args)
+        {
+            _countReceivedSink1++;
+        }
+
+        private void Sink2DataReceived(object sender, DataReceivedEventArgs args)
+        {
+            _countReceivedSink2++;
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Check data received event and exception")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.SinkNode.DataReceived E")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "EVL")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public async Task DataReceived_Add_NO_Exception()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create a pipeline instance and start
+                 * - Initialize the data received count
+                 */
+                var pipeline_handle = new Pipeline(_generalPipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                var sink_handle = pipeline_handle.GetSink("sinkx");
+                Assert.IsNotNull(sink_handle, "Failed to create sink node instance");
+                Assert.IsInstanceOf<Pipeline.SinkNode>(sink_handle, "Should return sink node instance");
+
+                /* TEST CODE */
+                sink_handle.DataReceived += SinkxDataReceived;
+
+                pipeline_handle.Start();
+                await Task.Delay(SleepTime);
+                pipeline_handle.Stop();
+                await Task.Delay(SleepTime);
+
+                Assert.Greater(_countReceivedSinkx, 0, "Failed to get data from sinkx node");
+
+                sink_handle.DataReceived -= SinkxDataReceived;
+                pipeline_handle.Dispose();
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else
+                {
+                    Assert.IsTrue(false, e.Message);
+                }
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check InvalidOperationException when subscribe sink node event after disposing the pipeline")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.SinkNode.DataReceived E")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "EEX")]
+        [Property("COVPARAM", "string")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public void DataReceived_Add_CHECK_InvalidOperationException_after_dispose()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create a pipeline instance and start
+                 * - Get sink node hadnle
+                 */
+                var pipeline_handle = new Pipeline(_generalPipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                var sink_handle = pipeline_handle.GetSink("sinkx");
+                Assert.IsNotNull(sink_handle, "Failed to create sink node instance");
+                Assert.IsInstanceOf<Pipeline.SinkNode>(sink_handle, "Should return sink node instance");
+
+                /* TEST CODE */
+                pipeline_handle.Dispose();
+                sink_handle.DataReceived += SinkxDataReceived;
+
+                Assert.True(false, "DO NOT COME HERE!");
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else if (e is InvalidOperationException)
+                {
+                    Assert.Pass("InvalidOperationException: passed!");
+                }
+                else
+                {
+                    Assert.Fail(e.Message);
+                }
+            }
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Check unsubscribe data event and exception")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.SinkNode.DataReceived E")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "EVL")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public async Task DataReceived_Remove_NO_Exception()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create a pipeline instance and start
+                 * - Initialize data received count
+                 * - Get sink node handle
+                 * - Subscribe the data received callback event
+                 */
+                var pipeline_handle = new Pipeline(_generalPipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                var sink_handle = pipeline_handle.GetSink("sinkx");
+                Assert.IsNotNull(sink_handle, "Failed to create sink node instance");
+                Assert.IsInstanceOf<Pipeline.SinkNode>(sink_handle, "Should return sink node instance");
+                sink_handle.DataReceived += SinkxDataReceived;
+
+                pipeline_handle.Start();
+                await Task.Delay(SleepTime);
+                pipeline_handle.Stop();
+                await Task.Delay(SleepTime);
+
+                Assert.Greater(_countReceivedSinkx, 0, "Failed to get data from sinkx node");
+                _countReceivedSinkx = 0;
+
+                /* TEST CODE */
+                sink_handle.DataReceived -= SinkxDataReceived;
+                pipeline_handle.Start();
+                await Task.Delay(SleepTime);
+                pipeline_handle.Stop();
+                await Task.Delay(SleepTime);
+
+                Assert.IsTrue(_countReceivedSinkx == 0);
+
+                pipeline_handle.Dispose();
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else
+                {
+                    Assert.IsTrue(false, e.Message);
+                }
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check InvalidOperationException when unsubscribe data event after disposing the pipeline")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.SinkNode.DataReceived E")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "EEX")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public void DataReceived_Remove_CHECK_InvalidOperationException_after_dispose()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create a pipeline instance and start
+                 * - Subscribe the data received callback event
+                 * - Get sink node handle
+                 */
+                var pipeline_handle = new Pipeline(_generalPipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                var sink_handle = pipeline_handle.GetSink("sinkx");
+                Assert.IsNotNull(sink_handle, "Failed to create sink node instance");
+                Assert.IsInstanceOf<Pipeline.SinkNode>(sink_handle, "Should return sink node instance");
+
+                /* TEST CODE */
+                pipeline_handle.Dispose();
+                sink_handle.DataReceived -= SinkxDataReceived;
+
+                Assert.True(false, "DO NOT COME HERE!");
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else if (e is InvalidOperationException)
+                {
+                    Assert.Pass("InvalidOperationException: passed!");
+                }
+                else
+                {
+                    Assert.Fail(e.Message);
+                }
+            }
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Check to subscribe multiple sink callback event")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.SinkNode.DataReceived E")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "EVL")]
+        [Property("COVPARAM", "string")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public async Task DataReceived_MultiSink_NO_Exception()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create a pipeline instance
+                 * - Subscribe the data received callback event from each sink node
+                 */
+                string multisink_pipeline = "videotestsrc is-live=true ! videoconvert ! tensor_converter ! tee name=t "
+                   + "t. ! queue ! tensor_sink name=sink_1 "
+                   + "t. ! queue ! tensor_sink name=sink_2";
+                var pipeline_handle = new Pipeline(multisink_pipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                _countReceivedSink1 = 0;
+                _countReceivedSink2 = 0;
+
+                var sink_handle_1 = pipeline_handle.GetSink("sink_1");
+                Assert.IsNotNull(sink_handle_1, "Failed to create sink node instance");
+                Assert.IsInstanceOf<Pipeline.SinkNode>(sink_handle_1, "Should return sink node instance");
+
+                var sink_handle_2 = pipeline_handle.GetSink("sink_2");
+                Assert.IsNotNull(sink_handle_2, "Failed to create sink node instance");
+                Assert.IsInstanceOf<Pipeline.SinkNode>(sink_handle_2, "Should return sink node instance");
+
+                /* TEST CODE */
+                sink_handle_1.DataReceived += Sink1DataReceived;
+                sink_handle_2.DataReceived += Sink2DataReceived;
+
+                pipeline_handle.Start();
+                await Task.Delay(SleepTime);
+                pipeline_handle.Stop();
+                await Task.Delay(SleepTime);
+
+                Assert.Greater(_countReceivedSink1, 0, "Failed to get data from sink_1 node");
+                Assert.Greater(_countReceivedSink2, 0, "Failed to get data from sink_2 node");
+
+                sink_handle_1.DataReceived -= Sink1DataReceived;
+                sink_handle_2.DataReceived -= Sink2DataReceived;
+                pipeline_handle.Dispose();
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else
+                {
+                    Assert.IsTrue(false, e.Message);
+                }
+            }
+        }
+    }
+}
diff --git a/tct-suite-vs/Tizen.MachineLearning.Inference.Tests/testcase/TSPipeline.SourceNode.cs b/tct-suite-vs/Tizen.MachineLearning.Inference.Tests/testcase/TSPipeline.SourceNode.cs
new file mode 100644 (file)
index 0000000..f63445c
--- /dev/null
@@ -0,0 +1,357 @@
+/*
+ *  Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License
+ */
+
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using System.IO;
+using Tizen;
+using Tizen.System;
+using Tizen.MachineLearning.Inference;
+using System.Threading.Tasks;
+
+namespace Tizen.MachineLearning.Inference.Tests {
+    [TestFixture]
+    [Description("Tizen.MachineLearning.Inference.Pipeline.SourceNode Tests")]
+    public class PipelineSourceNodeTests
+    {
+        private const string TAG = "Tizen.MachineLearning.Inference.Tests";
+        private const string FeatureKey = "http://tizen.org/feature/machine_learning.inference";
+        private const int SleepTime = 1000; // default sleep time to run the pipeline
+
+        private readonly string _appsrcPipeline = "appsrc name=srcx ! other/tensor,dimension=(string)4:1:1:1,type=(string)uint8,framerate=(fraction)0/1 ! tensor_sink name=sinkx";
+        private bool _isMachineLeanringInferenceSupported = false;
+
+        [SetUp]
+        public void Init()
+        {
+            LogUtils.Write(LogUtils.DEBUG, TAG, "Preconditions for Tizen.MachineLearning.Inference TEST");
+
+            Information.TryGetValue(FeatureKey, out _isMachineLeanringInferenceSupported);
+
+            if (!_isMachineLeanringInferenceSupported)
+            {
+                LogUtils.Write(LogUtils.DEBUG, TAG, "ML feature is not supported.");
+            }
+        }
+
+        [TearDown]
+        public void Destroy()
+        {
+            LogUtils.Write(LogUtils.DEBUG, TAG, "Postconditions for Tizen.MachineLearning.Inference TEST");
+
+            if (_isMachineLeanringInferenceSupported)
+            {
+                /* release if any res initialized */
+            }
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Push data to the pipeline and check exception")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.SourceNode.Input M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("COVPARAM", "TensorsData")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public async Task Input_NO_Exception()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create a pipeline instance and start
+                 * - Get source node handle
+                 * - Create tensors data
+                 */
+                var pipeline_handle = new Pipeline(_appsrcPipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                var src_handle = pipeline_handle.GetSource("srcx");
+                Assert.IsNotNull(src_handle, "Failed to create source node instance");
+                Assert.IsInstanceOf<Pipeline.SourceNode>(src_handle, "Should return source node instance");
+
+                var in_info = new TensorsInfo();
+                Assert.IsNotNull(in_info, "Failed to create TensorsInfo instance");
+                Assert.IsInstanceOf<TensorsInfo>(in_info, "Should return TensorsInfo instance");
+                in_info.AddTensorInfo(TensorType.UInt8, new int[4] { 4, 1, 1, 1 });
+
+                var in_data = in_info.GetTensorsData();
+                Assert.IsNotNull(in_data, "Failed to create TensorsData instance");
+                Assert.IsInstanceOf<TensorsData>(in_data, "Should return TensorsData instance");
+
+                pipeline_handle.Start();
+                await Task.Delay(SleepTime);
+
+                /* TEST CODE */
+                src_handle.Input(in_data);
+
+                pipeline_handle.Dispose();
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else
+                {
+                    Assert.IsTrue(false, e.Message);
+                }
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check ArgumentException when push data to source node with null data")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.SourceNode.Input M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("COVPARAM", "TensorsData")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public async Task Input_CHECK_ArgumentException_null_data()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create a pipeline instance and start
+                 * - Get source node handle
+                 */
+                var pipeline_handle = new Pipeline(_appsrcPipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                var src_handle = pipeline_handle.GetSource("srcx");
+                Assert.IsNotNull(src_handle, "Failed to create source node instance");
+                Assert.IsInstanceOf<Pipeline.SourceNode>(src_handle, "Should return source node instance");
+
+                pipeline_handle.Start();
+                await Task.Delay(SleepTime);
+
+                /* TEST CODE */
+                src_handle.Input(null);
+
+                pipeline_handle.Dispose();
+                Assert.True(false, "DO NOT COME HERE!");
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else if (e is ArgumentException)
+                {
+                    Assert.Pass("ArgumentException: passed!");
+                }
+                else
+                {
+                    Assert.Fail(e.Message);
+                }
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check ArgumentException when push data to source node with invalid dimension")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.SourceNode.Input M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("COVPARAM", "TensorsData")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public async Task Input_CHECK_ArgumentException_invalid_dimension()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create a pipeline instance and start
+                 * - Get source node handle
+                 * - Create tensors info and data
+                 */
+                var pipeline_handle = new Pipeline(_appsrcPipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                var src_handle = pipeline_handle.GetSource("srcx");
+                Assert.IsNotNull(src_handle, "Failed to create source node instance");
+                Assert.IsInstanceOf<Pipeline.SourceNode>(src_handle, "Should return source node instance");
+
+                var in_info = new TensorsInfo();
+                Assert.IsNotNull(in_info, "Failed to create TensorsInfo instance");
+                Assert.IsInstanceOf<TensorsInfo>(in_info, "Should return TensorsInfo instance");
+                in_info.AddTensorInfo(TensorType.UInt8, new int[4] { 4, 4, 4, 4 });
+
+                var in_data = in_info.GetTensorsData();
+                Assert.IsNotNull(in_data, "Failed to create TensorsData instance");
+                Assert.IsInstanceOf<TensorsData>(in_data, "Should return TensorsData instance");
+
+                pipeline_handle.Start();
+                await Task.Delay(SleepTime);
+
+                /* TEST CODE */
+                src_handle.Input(in_data);
+
+                pipeline_handle.Dispose();
+                Assert.True(false, "DO NOT COME HERE!");
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else if (e is ArgumentException)
+                {
+                    Assert.Pass("ArgumentException: passed!");
+                }
+                else
+                {
+                    Assert.Fail(e.Message);
+                }
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check ArgumentException when push data to source node with invalid data type")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.SourceNode.Input M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("COVPARAM", "TensorsData")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public async Task Input_CHECK_ArgumentException_invalid_data_type()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create a pipeline instance and start
+                 * - Get source node handle
+                 * - Create tensors data and info
+                 */
+                var pipeline_handle = new Pipeline(_appsrcPipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                var src_handle = pipeline_handle.GetSource("srcx");
+                Assert.IsNotNull(src_handle, "Failed to create source node instance");
+                Assert.IsInstanceOf<Pipeline.SourceNode>(src_handle, "Should return source node instance");
+
+                var in_info = new TensorsInfo();
+                Assert.IsNotNull(in_info, "Failed to create TensorsInfo instance");
+                Assert.IsInstanceOf<TensorsInfo>(in_info, "Should return TensorsInfo instance");
+                in_info.AddTensorInfo(TensorType.UInt32, new int[4] { 4, 1, 1, 1 });
+
+                var in_data = in_info.GetTensorsData();
+                Assert.IsNotNull(in_data, "Failed to create TensorsData instance");
+                Assert.IsInstanceOf<TensorsData>(in_data, "Should return TensorsData instance");
+
+                pipeline_handle.Start();
+                await Task.Delay(SleepTime);
+
+                /* TEST CODE */
+                src_handle.Input(in_data);
+
+                pipeline_handle.Dispose();
+                Assert.True(false, "DO NOT COME HERE!");
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else if (e is ArgumentException)
+                {
+                    Assert.Pass("ArgumentException: passed!");
+                }
+                else
+                {
+                    Assert.Fail(e.Message);
+                }
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check InvalidOperationException when push data to source node after disposing the pipeline")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.SourceNode.Input M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("COVPARAM", "TensorsData")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public async Task Input_CHECK_InvalidOperationException_after_dispose()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create a pipeline instance and start
+                 * - Get source node handle
+                 * - Create tensors data
+                 */
+                var pipeline_handle = new Pipeline(_appsrcPipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                var src_handle = pipeline_handle.GetSource("srcx");
+                Assert.IsNotNull(src_handle, "Failed to create source node instance");
+                Assert.IsInstanceOf<Pipeline.SourceNode>(src_handle, "Should return source node instance");
+
+                var in_info = new TensorsInfo();
+                Assert.IsNotNull(in_info, "Failed to create TensorsInfo instance");
+                Assert.IsInstanceOf<TensorsInfo>(in_info, "Should return TensorsInfo instance");
+                in_info.AddTensorInfo(TensorType.UInt8, new int[4] { 4, 1, 1, 1 });
+
+                var in_data = in_info.GetTensorsData();
+                Assert.IsNotNull(in_data, "Failed to create TensorsData instance");
+                Assert.IsInstanceOf<TensorsData>(in_data, "Should return TensorsData instance");
+
+                pipeline_handle.Start();
+                await Task.Delay(SleepTime);
+
+                /* TEST CODE */
+                pipeline_handle.Dispose();
+                src_handle.Input(in_data);
+
+                Assert.True(false, "DO NOT COME HERE!");
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else if (e is InvalidOperationException)
+                {
+                    Assert.Pass("InvalidOperationException: passed!");
+                }
+                else
+                {
+                    Assert.Fail(e.Message);
+                }
+            }
+        }
+    }
+}
diff --git a/tct-suite-vs/Tizen.MachineLearning.Inference.Tests/testcase/TSPipeline.SwitchNode.cs b/tct-suite-vs/Tizen.MachineLearning.Inference.Tests/testcase/TSPipeline.SwitchNode.cs
new file mode 100644 (file)
index 0000000..f8482ce
--- /dev/null
@@ -0,0 +1,275 @@
+/*
+ *  Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License
+ */
+
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using System.IO;
+using Tizen;
+using Tizen.System;
+using Tizen.MachineLearning.Inference;
+using System.Threading.Tasks;
+
+namespace Tizen.MachineLearning.Inference.Tests {
+    [TestFixture]
+    [Description("Tizen.MachineLearning.Inference.Pipeline.SwitchNode Tests")]
+    public class PipelineSwitchNodeTests
+    {
+        private const string TAG = "Tizen.MachineLearning.Inference.Tests";
+        private const string FeatureKey = "http://tizen.org/feature/machine_learning.inference";
+        private const int SleepTime = 1000; // default sleep time to run the pipeline
+
+        private readonly string _switchPipeline = "input-selector name=ins ! tensor_converter ! tensor_sink name=sinkx "
+                                                    + "videotestsrc is-live=true ! videoconvert ! ins.sink_0 "
+                                                    + "videotestsrc is-live=true ! videoconvert ! ins.sink_1";
+        private int _countReceived;
+        private bool _isMachineLeanringInferenceSupported = false;
+
+        [SetUp]
+        public void Init()
+        {
+            LogUtils.Write(LogUtils.DEBUG, TAG, "Preconditions for Tizen.MachineLearning.Inference TEST");
+
+            Information.TryGetValue(FeatureKey, out _isMachineLeanringInferenceSupported);
+
+            if (!_isMachineLeanringInferenceSupported)
+            {
+                LogUtils.Write(LogUtils.DEBUG, TAG, "ML feature is not supported.");
+            }
+
+            _countReceived = 0;
+        }
+
+        [TearDown]
+        public void Destroy()
+        {
+            LogUtils.Write(LogUtils.DEBUG, TAG, "Postconditions for Tizen.MachineLearning.Inference TEST");
+
+            if (_isMachineLeanringInferenceSupported)
+            {
+                /* release if any res initialized */
+            }
+        }
+
+        private void DataReceivedEvent(object sender, DataReceivedEventArgs args)
+        {
+            _countReceived++;
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Get swtich pad and check exception")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.SwitchNode.Select M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("COVPARAM", "string")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public async Task Select_NO_Exception()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create a pipeline instance
+                 * - Get the sink node handle
+                 * - Subscribe the data received callback event
+                 */
+                var pipeline_handle = new Pipeline(_switchPipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                var sink_handle = pipeline_handle.GetSink("sinkx");
+                Assert.IsNotNull(sink_handle, "Failed to create sink node instance");
+                Assert.IsInstanceOf<Pipeline.SinkNode>(sink_handle, "Should return sink node instance");
+                sink_handle.DataReceived += DataReceivedEvent;
+
+                var switch_handle = pipeline_handle.GetSwitch("ins");
+                Assert.IsNotNull(switch_handle, "Failed to create switch node instance");
+                Assert.IsInstanceOf<Pipeline.SwitchNode>(switch_handle, "Should return switch node instance");
+
+                /* TEST CODE */
+                switch_handle.Select("sink_1");
+
+                pipeline_handle.Start();
+                await Task.Delay(SleepTime);
+                pipeline_handle.Stop();
+                await Task.Delay(SleepTime);
+
+                Assert.Greater(_countReceived, 0, "Failed to select input pad");
+
+                sink_handle.DataReceived -= DataReceivedEvent;
+                pipeline_handle.Dispose();
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else
+                {
+                    Assert.IsTrue(false, e.Message);
+                }
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check ArgumentException when selecting pad with null pad name")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.SwitchNode.Select M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("COVPARAM", "string")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public void Select_CHECK_ArgumentException_null_name()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create a pipeline instance
+                 * - Get the switch node handle
+                 */
+                var pipeline_handle = new Pipeline(_switchPipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                var switch_handle = pipeline_handle.GetSwitch("ins");
+                Assert.IsNotNull(switch_handle, "Failed to create switch node instance");
+                Assert.IsInstanceOf<Pipeline.SwitchNode>(switch_handle, "Should return switch node instance");
+
+                /* TEST CODE */
+                switch_handle.Select(null);
+
+                Assert.True(false, "DO NOT COME HERE!");
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else if (e is ArgumentException)
+                {
+                    Assert.Pass("ArgumentException: passed!");
+                }
+                else
+                {
+                    Assert.Fail("Unexpected Exception: failed.");
+                }
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check ArgumentException when selecting pad with invalid pad name")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.SwitchNode.Select M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("COVPARAM", "string")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public void Select_CHECK_ArgumentException_invalid_name()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create a pipeline instance
+                 * - Get the switch node handle
+                 */
+                var pipeline_handle = new Pipeline(_switchPipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                var switch_handle = pipeline_handle.GetSwitch("ins");
+                Assert.IsNotNull(switch_handle, "Failed to create switch node instance");
+                Assert.IsInstanceOf<Pipeline.SwitchNode>(switch_handle, "Should return switch node instance");
+
+                /* TEST CODE */
+                switch_handle.Select("invalid_pad");
+
+                Assert.True(false, "DO NOT COME HERE!");
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else if (e is ArgumentException)
+                {
+                    Assert.Pass("ArgumentException: passed!");
+                }
+                else
+                {
+                    Assert.Fail("Unexpected Exception: failed.");
+                }
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check InvalidOperation when selecting pad after disposing the pipeline")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.SwitchNode.Select M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("COVPARAM", "string")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public void Select_CHECK_InvalidOperationException_after_dispose()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create a pipeline instance
+                 * - Get the switch node handle
+                 */
+                var pipeline_handle = new Pipeline(_switchPipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                var switch_handle = pipeline_handle.GetSwitch("ins");
+                Assert.IsNotNull(switch_handle, "Failed to create switch node instance");
+                Assert.IsInstanceOf<Pipeline.SwitchNode>(switch_handle, "Should return switch node instance");
+
+                /* TEST CODE */
+                pipeline_handle.Dispose();
+                switch_handle.Select("sink_1");
+
+                Assert.True(false, "DO NOT COME HERE!");
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else if (e is InvalidOperationException)
+                {
+                    Assert.Pass("InvalidOperationException: passed!");
+                }
+                else
+                {
+                    Assert.Fail("Unexpected Exception: failed.");
+                }
+            }
+        }
+    }
+}
diff --git a/tct-suite-vs/Tizen.MachineLearning.Inference.Tests/testcase/TSPipeline.ValveNode.cs b/tct-suite-vs/Tizen.MachineLearning.Inference.Tests/testcase/TSPipeline.ValveNode.cs
new file mode 100644 (file)
index 0000000..5e26126
--- /dev/null
@@ -0,0 +1,244 @@
+/*
+ *  Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License
+ */
+
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using System.IO;
+using Tizen;
+using Tizen.System;
+using Tizen.MachineLearning.Inference;
+using System.Threading.Tasks;
+
+namespace Tizen.MachineLearning.Inference.Tests {
+    [TestFixture]
+    [Description("Tizen.MachineLearning.Inference.Pipeline.ValveNode Tests")]
+    public class PipelineValveNodeTests
+    {
+        private const string TAG = "Tizen.MachineLearning.Inference.Tests";
+        private const string FeatureKey = "http://tizen.org/feature/machine_learning.inference";
+        private const int SleepTime = 1000; // default sleep time to run the pipeline
+
+        private readonly string _valvePipeline = "videotestsrc is-live=true ! videoconvert ! valve name=valvex ! tensor_converter ! tensor_sink name=sinkx";
+        private int _countReceived;
+        private bool _isMachineLeanringInferenceSupported = false;
+
+        [SetUp]
+        public void Init()
+        {
+            LogUtils.Write(LogUtils.DEBUG, TAG, "Preconditions for Tizen.MachineLearning.Inference TEST");
+
+            Information.TryGetValue(FeatureKey, out _isMachineLeanringInferenceSupported);
+
+            if (!_isMachineLeanringInferenceSupported)
+            {
+                LogUtils.Write(LogUtils.DEBUG, TAG, "ML feature is not supported.");
+            }
+
+            _countReceived = 0;
+        }
+
+        [TearDown]
+        public void Destroy()
+        {
+            LogUtils.Write(LogUtils.DEBUG, TAG, "Postconditions for Tizen.MachineLearning.Inference TEST");
+
+            if (_isMachineLeanringInferenceSupported)
+            {
+                /* release if any res initialized */
+            }
+        }
+
+        private void DataReceivedEvent(object sender, DataReceivedEventArgs args)
+        {
+            _countReceived++;
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Close data flow using valve and check exception")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.ValveNode.Control M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("COVPARAM", "string")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public async Task Control_Close_NO_Exception()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create a pipeline instance
+                 * - Get the sink node handle
+                 * - Subscribe the data received callback event
+                 */
+                var pipeline_handle = new Pipeline(_valvePipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                var sink_handle = pipeline_handle.GetSink("sinkx");
+                Assert.IsNotNull(sink_handle, "Failed to create sink node instance");
+                Assert.IsInstanceOf<Pipeline.SinkNode>(sink_handle, "Should return sink node instance");
+                sink_handle.DataReceived += DataReceivedEvent;
+
+                var valve_handle = pipeline_handle.GetValve("valvex");
+                Assert.IsNotNull(valve_handle, "Failed to create valve node instance");
+                Assert.IsInstanceOf<Pipeline.ValveNode>(valve_handle, "Should return valve node instance");
+
+                /* TEST CODE */
+                valve_handle.Control(false);
+
+                pipeline_handle.Start();
+                await Task.Delay(SleepTime);
+                pipeline_handle.Stop();
+                await Task.Delay(SleepTime);
+
+                Assert.IsTrue(_countReceived == 0, "Failed to close data flow");
+
+                sink_handle.DataReceived -= DataReceivedEvent;
+                pipeline_handle.Dispose();
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else
+                {
+                    Assert.IsTrue(false, e.Message);
+                }
+            }
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Open data flow using valve and check exception")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.ValveNode.Control M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("COVPARAM", "bool")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public async Task Control_Open_NO_Exception()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create a pipeline instance and start
+                 * - Get the sink and valve node handle
+                 * - Subscribe the data received callback event
+                 * - Close data flow
+                 */
+                var pipeline_handle = new Pipeline(_valvePipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                var sink_handle = pipeline_handle.GetSink("sinkx");
+                Assert.IsNotNull(sink_handle, "Failed to create sink node instance");
+                Assert.IsInstanceOf<Pipeline.SinkNode>(sink_handle, "Should return sink node instance");
+                sink_handle.DataReceived += DataReceivedEvent;
+
+                var valve_handle = pipeline_handle.GetValve("valvex");
+                Assert.IsNotNull(valve_handle, "Failed to create valve node instance");
+                Assert.IsInstanceOf<Pipeline.ValveNode>(valve_handle, "Should return valve node instance");
+                valve_handle.Control(false);
+
+                pipeline_handle.Start();
+                await Task.Delay(SleepTime);
+                pipeline_handle.Stop();
+                await Task.Delay(SleepTime);
+
+                Assert.IsTrue(_countReceived == 0, "Failed to close data flow");
+
+                /* TEST CODE */
+                valve_handle.Control(true);
+
+                pipeline_handle.Start();
+                await Task.Delay(SleepTime);
+                pipeline_handle.Stop();
+                await Task.Delay(SleepTime);
+
+                Assert.Greater(_countReceived, 0, "Failed to open data flow");
+
+                sink_handle.DataReceived -= DataReceivedEvent;
+                pipeline_handle.Dispose();
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else
+                {
+                    Assert.IsTrue(false, e.Message);
+                }
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check InvalidOperation when controling valve after disposing the pipeline")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.ValveNode.Control M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("COVPARAM", "bool")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public void Control_CHECK_InvalidOperationException_after_dispose()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create a pipeline instance
+                 * - Create the vlave node handle
+                 */
+                var pipeline_handle = new Pipeline(_valvePipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                var valve_handle = pipeline_handle.GetValve("valvex");
+                Assert.IsNotNull(valve_handle, "Failed to create valve node instance");
+                Assert.IsInstanceOf<Pipeline.ValveNode>(valve_handle, "Should return valve node instance");
+
+                /* TEST CODE */
+                pipeline_handle.Dispose();
+                valve_handle.Control(true);
+
+                Assert.True(false, "DO NOT COME HERE!");
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else if (e is InvalidOperationException)
+                {
+                    Assert.Pass("InvalidOperationException: passed!");
+                }
+                else
+                {
+                    Assert.Fail("Unexpected Exception: failed.");
+                }
+            }
+        }
+    }
+}
diff --git a/tct-suite-vs/Tizen.MachineLearning.Inference.Tests/testcase/TSPipeline.cs b/tct-suite-vs/Tizen.MachineLearning.Inference.Tests/testcase/TSPipeline.cs
new file mode 100644 (file)
index 0000000..3860209
--- /dev/null
@@ -0,0 +1,998 @@
+/*
+ *  Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License
+ */
+
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using System.IO;
+using Tizen;
+using Tizen.System;
+using Tizen.MachineLearning.Inference;
+using System.Threading.Tasks;
+
+namespace Tizen.MachineLearning.Inference.Tests {
+    [TestFixture]
+    [Description("Tizen.MachineLearning.Inference.Pipeline Tests")]
+    public class PipelineTests
+    {
+        private const string TAG = "Tizen.MachineLearning.Inference.Tests";
+        private const string FeatureKey = "http://tizen.org/feature/machine_learning.inference";
+        private const int SleepTime = 1000; // default sleep time to run the pipeline
+
+        private readonly string _generalPipeline = "videotestsrc is-live=true ! videoconvert ! valve name=valvex ! tensor_converter ! tensor_sink name=sinkx async=false";
+        private readonly string _appsrcPipeline = "appsrc name=srcx ! other/tensor,dimension=(string)4:1:1:1,type=(string)uint8,framerate=(fraction)0/1 ! tensor_sink name=sinkx";
+        private readonly string _valvePipeline = "videotestsrc is-live=true ! videoconvert ! valve name=valvex ! tensor_converter ! tensor_sink name=sinkx";
+        private readonly string _switchPipeline = "input-selector name=ins ! tensor_converter ! tensor_sink name=sinkx "
+                                                    + "videotestsrc is-live=true ! videoconvert ! ins.sink_0 "
+                                                    + "videotestsrc is-live=true ! videoconvert ! ins.sink_1";
+        private PipelineState _changedState;
+        private bool _isMachineLeanringInferenceSupported = false;
+
+        [SetUp]
+        public void Init()
+        {
+            LogUtils.Write(LogUtils.DEBUG, TAG, "Preconditions for Tizen.MachineLearning.Inference TEST");
+
+            Information.TryGetValue(FeatureKey, out _isMachineLeanringInferenceSupported);
+
+            if (!_isMachineLeanringInferenceSupported)
+            {
+                LogUtils.Write(LogUtils.DEBUG, TAG, "ML feature is not supported.");
+            }
+
+            _changedState = PipelineState.Null;
+        }
+
+        [TearDown]
+        public void Destroy()
+        {
+            LogUtils.Write(LogUtils.DEBUG, TAG, "Postconditions for Tizen.MachineLearning.Inference TEST");
+
+            if (_isMachineLeanringInferenceSupported)
+            {
+            }
+        }
+
+        private void StateChangedCallback(object sender, StateChangedEventArgs args)
+        {
+            _changedState = args.State;
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Create a pipeline instance")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.Pipeline C")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "CONSTR")]
+        [Property("COVPARAM", "string")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public void Pipeline_INIT()
+        {
+            try
+            {
+                /* TEST CODE */
+                var pipeline_handle = new Pipeline(_generalPipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                pipeline_handle.Dispose();
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else
+                {
+                    Assert.IsTrue(false, e.Message);
+                }
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check ArgumentException when creating pipeline instance with null description")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.Pipeline C")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "CONSTN")]
+        [Property("COVPARAM", "string")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public void Pipeline_INIT_CHECK_ArgumentException_null_description()
+        {
+            try
+            {
+                /* TEST CODE */
+                var pipeline_handle = new Pipeline(null);
+
+                Assert.True(false, "DO NOT COME HERE!");
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else if (e is ArgumentException)
+                {
+                    Assert.Pass("ArgumentException: passed!");
+                }
+                else
+                {
+                    Assert.Fail("Unexpected Exception: failed..");
+                }
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check ArgumentException when creating pipeline instance with empty description")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.Pipeline C")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "CONSTX")]
+        [Property("COVPARAM", "string")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public void Pipeline_INIT_CHECK_ArgumentException_empty_description()
+        {
+            try
+            {
+                /* TEST CODE */
+                var pipeline_handle = new Pipeline("");
+
+                Assert.True(false, "DO NOT COME HERE!");
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else if (e is ArgumentException)
+                {
+                    Assert.Pass("ArgumentException: passed!");
+                }
+                else
+                {
+                    Assert.Fail("Unexpected Exception: failed..");
+                }
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check InvalidOperationException when creating pipeline instance")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.Pipeline C")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "CONSTX")]
+        [Property("COVPARAM", "string")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public void Pipeline_INIT_CHECK_InvalidOperationException()
+        {
+            try
+            {
+                string description = "nonexistsrc ! fakesink";
+
+                /* TEST CODE */
+                var pipeline_handle = new Pipeline(description);
+
+                Assert.True(false, "DO NOT COME HERE!");
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else if (e is InvalidOperationException)
+                {
+                    Assert.Pass("InvalidOperationException: passed!");
+                }
+                else
+                {
+                    Assert.Fail(e.Message);
+                }
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check InvalidOperationException when creating pipeline instance")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.Pipeline C")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "CONSTX")]
+        [Property("COVPARAM", "string")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public void Pipeline_INIT_CHECK_UnauthorizedAccessException()
+        {
+            try
+            {
+                string description = "tizencamvideosrc ! videoconvert ! videoscale ! video/x-raw,format=RGB,width=320,height=240 ! tensor_converter ! tensor_sink";
+
+                /* TEST CODE */
+                var pipeline_handle = new Pipeline(description);
+
+                Assert.True(false, "DO NOT COME HERE!");
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else if (e is UnauthorizedAccessException)
+                {
+                    Assert.Pass("UnauthorizedAccessException: passed!");
+                }
+                else
+                {
+                    Assert.Fail(e.Message);
+                }
+            }
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Get the state of the pipeline and check exception")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.State A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRO")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public void State_Property_NO_Exception()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create a pipeline instance
+                 */
+                var pipeline_handle = new Pipeline(_generalPipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                /* TEST CODE */
+                var retState = pipeline_handle.State;
+                Assert.IsTrue(retState == PipelineState.Paused, "Invalid state of the pipeline");
+
+                pipeline_handle.Dispose();
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else
+                {
+                    Assert.IsTrue(false, e.Message);
+                }
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check InvalidOperationException when getting Pipeline state after dispose")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.State A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PEX")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public void State_Property_CHECK_InvalidOperationException_after_dispose()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create a pipeline instance
+                 * - Dispose the pipeline
+                 */
+                var pipeline_handle = new Pipeline(_generalPipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                /* TEST CODE */
+                pipeline_handle.Dispose();
+                var retState = pipeline_handle.State;
+
+                Assert.True(false, "DO NOT COME HERE!");
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else if (e is InvalidOperationException)
+                {
+                    Assert.Pass("InvalidOperationException: passed!");
+                }
+                else
+                {
+                    Assert.Fail(e.Message);
+                }
+            }
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Start the pipeline and check exception")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.Start M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MCST")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public async Task Start_NO_Exception()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create a pipeline instance
+                 */
+                var pipeline_handle = new Pipeline(_generalPipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                /* TEST CODE */
+                pipeline_handle.Start();
+                await Task.Delay(SleepTime);
+
+                var retState = pipeline_handle.State;
+                Assert.IsTrue(retState == PipelineState.Playing);
+
+                pipeline_handle.Dispose();
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else
+                {
+                    Assert.IsTrue(false, e.Message);
+                }
+            }
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Stop the pipeline and check exception")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.Stop M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MCST")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public async Task Stop_NO_Exception()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create a pipeline instance and start
+                 */
+                var pipeline_handle = new Pipeline(_generalPipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                pipeline_handle.Start();
+                await Task.Delay(SleepTime);
+
+                /* TEST CODE */
+                pipeline_handle.Stop();
+                await Task.Delay(SleepTime);
+
+                var retState = pipeline_handle.State;
+                Assert.IsTrue(retState == PipelineState.Paused);
+
+                pipeline_handle.Dispose();
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else
+                {
+                    Assert.IsTrue(false, e.Message);
+                }
+            }
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Check state change callback and exception")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.StateChanged E")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "EVL")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public async Task StateChanged_NO_Exception()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create a pipeline instance
+                 */
+                var pipeline_handle = new Pipeline(_generalPipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                /* TEST CODE */
+                pipeline_handle.StateChanged += StateChangedCallback;
+
+                pipeline_handle.Start();
+                await Task.Delay(SleepTime);
+
+                Assert.IsTrue(_changedState == PipelineState.Playing);
+
+                pipeline_handle.StateChanged -= StateChangedCallback;
+                pipeline_handle.Dispose();
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else
+                {
+                    Assert.IsTrue(false, e.Message);
+                }
+            }
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test to get sink node without exception")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.GetSink M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public void GetSink_NO_Exception()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create a pipeline instance and start
+                 * - Get sink handle
+                 */
+                var pipeline_handle = new Pipeline(_generalPipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                /* TEST CODE */
+                var sink_handle = pipeline_handle.GetSink("sinkx");
+                Assert.IsNotNull(sink_handle, "Failed to create sink node instance");
+                Assert.IsInstanceOf<Pipeline.SinkNode>(sink_handle, "Should return sink node instance");
+
+                Assert.IsTrue(sink_handle.Name == "sinkx");
+                Assert.IsTrue(sink_handle.Type == Pipeline.NodeType.Sink);
+                Assert.IsTrue(sink_handle.Valid == true);
+
+                pipeline_handle.Dispose();
+                Assert.IsTrue(sink_handle.Valid == false);
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else
+                {
+                    Assert.IsTrue(false, e.Message);
+                }
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check ArgumentException when getting sink node with null name")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.GetSink M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("COVPARAM", "string")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public void GetSink_CHECK_ArgumentException_null_name()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create a pipeline instance and start
+                 */
+                var pipeline_handle = new Pipeline(_generalPipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                /* TEST CODE */
+                var sink_handle = pipeline_handle.GetSink(null);
+
+                pipeline_handle.Dispose();
+                Assert.True(false, "DO NOT COME HERE!");
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else if (e is ArgumentException)
+                {
+                    Assert.Pass("ArgumentException: passed!");
+                }
+                else
+                {
+                    Assert.Fail(e.Message);
+                }
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check ArgumentException when getting sink node event with invalid name")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.GetSink M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("COVPARAM", "string")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public void GetSink_CHECK_ArgumentException_invalid_name()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create a pipeline instance and start
+                 */
+                var pipeline_handle = new Pipeline(_generalPipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                /* TEST CODE */
+                var sink_handle = pipeline_handle.GetSink("invalid_sink");
+
+                pipeline_handle.Dispose();
+                Assert.True(false, "DO NOT COME HERE!");
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else if (e is ArgumentException)
+                {
+                    Assert.Pass("ArgumentException: passed!");
+                }
+                else
+                {
+                    Assert.Fail(e.Message);
+                }
+            }
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test to get source node without exception")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.GetSource M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public void GetSource_NO_Exception()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create instance and start the pipeline
+                 * - Get source handle
+                 */
+                var pipeline_handle = new Pipeline(_appsrcPipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                /* TEST CODE */
+                var src_handle = pipeline_handle.GetSource("srcx");
+                Assert.IsNotNull(src_handle, "Failed to create source node instance");
+                Assert.IsInstanceOf<Pipeline.SourceNode>(src_handle, "Should return source node instance");
+
+                Assert.IsTrue(src_handle.Name == "srcx");
+                Assert.IsTrue(src_handle.Type == Pipeline.NodeType.Source);
+                Assert.IsTrue(src_handle.Valid == true);
+
+                pipeline_handle.Dispose();
+                Assert.IsTrue(src_handle.Valid == false);
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else
+                {
+                    Assert.IsTrue(false, e.Message);
+                }
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check ArgumentException when getting source node with null name")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.GetSource M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("COVPARAM", "string")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public void GetSource_CHECK_ArgumentException_null_name()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create a pipeline instance
+                 */
+                var pipeline_handle = new Pipeline(_appsrcPipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                /* TEST CODE */
+                var source_handle = pipeline_handle.GetSource(null);
+
+                pipeline_handle.Dispose();
+                Assert.True(false, "DO NOT COME HERE!");
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else if (e is ArgumentException)
+                {
+                    Assert.Pass("ArgumentException: passed!");
+                }
+                else
+                {
+                    Assert.Fail(e.Message);
+                }
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check ArgumentException when getting source node with invalid name")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.GetSource M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("COVPARAM", "string")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public void GetSource_CHECK_ArgumentException_invalid_name()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create a pipeline instance
+                 */
+                var pipeline_handle = new Pipeline(_appsrcPipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                /* TEST CODE */
+                var source_handle = pipeline_handle.GetSource("invalid_src");
+
+                pipeline_handle.Dispose();
+                Assert.True(false, "DO NOT COME HERE!");
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else if (e is ArgumentException)
+                {
+                    Assert.Pass("ArgumentException: passed!");
+                }
+                else
+                {
+                    Assert.Fail(e.Message);
+                }
+            }
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test to get switch node without exception")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.GetSwitch M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public void GetSwitch_NO_Exception()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create a pipeline instance and start
+                 * - Get switch handle
+                 */
+                var pipeline_handle = new Pipeline(_switchPipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                /* TEST CODE */
+                var switch_handle = pipeline_handle.GetSwitch("ins");
+                Assert.IsNotNull(switch_handle, "Failed to create switch node instance");
+                Assert.IsInstanceOf<Pipeline.SwitchNode>(switch_handle, "Should return switch node instance");
+
+                Assert.IsTrue(switch_handle.Name == "ins");
+                Assert.IsTrue(switch_handle.Type == Pipeline.NodeType.Switch);
+                Assert.IsTrue(switch_handle.Valid == true);
+
+                pipeline_handle.Dispose();
+                Assert.IsTrue(switch_handle.Valid == false);
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else
+                {
+                    Assert.IsTrue(false, e.Message);
+                }
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check ArgumentException when selecting pad with null switch name")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.GetSwitch M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("COVPARAM", "string")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public void GetSwitch_CHECK_ArgumentException_null_name()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create a pipeline instance
+                 */
+                var pipeline_handle = new Pipeline(_switchPipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                /* TEST CODE */
+                var switch_handle = pipeline_handle.GetSwitch(null);
+
+                Assert.True(false, "DO NOT COME HERE!");
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else if (e is ArgumentException)
+                {
+                    Assert.Pass("ArgumentException: passed!");
+                }
+                else
+                {
+                    Assert.Fail("Unexpected Exception: failed..");
+                }
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check ArgumentException when selecting pad with invalid switch name")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.GetSwitch M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("COVPARAM", "string")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public void GetSwitch_CHECK_ArgumentException_invalid_name()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create a pipeline instance
+                 */
+                var pipeline_handle = new Pipeline(_switchPipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                /* TEST CODE */
+                var switch_handle = pipeline_handle.GetSwitch("invalid_switch");
+
+                Assert.True(false, "DO NOT COME HERE!");
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else if (e is ArgumentException)
+                {
+                    Assert.Pass("ArgumentException: passed!");
+                }
+                else
+                {
+                    Assert.Fail("Unexpected Exception: failed..");
+                }
+            }
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test to get valve node without exception")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.GetValve M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public void GetValve_NO_Exception()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create a pipeline instance and start
+                 * - Get the valve node handle
+                 */
+                var pipeline_handle = new Pipeline(_valvePipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                /* TEST CODE */
+                var valve_handle = pipeline_handle.GetValve("valvex");
+                Assert.IsNotNull(valve_handle, "Failed to create valve node instance");
+                Assert.IsInstanceOf<Pipeline.ValveNode>(valve_handle, "Should return valve node instance");
+
+                Assert.IsTrue(valve_handle.Name == "valvex");
+                Assert.IsTrue(valve_handle.Type == Pipeline.NodeType.Valve);
+                Assert.IsTrue(valve_handle.Valid == true);
+
+                pipeline_handle.Dispose();
+                Assert.IsTrue(valve_handle.Valid == false);
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else
+                {
+                    Assert.IsTrue(false, e.Message);
+                }
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check ArgumentException when controling valve with null name")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.GetValve M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("COVPARAM", "string")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public void GetValve_CHECK_ArgumentException_null_name()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create a pipeline instance
+                 */
+                var pipeline_handle = new Pipeline(_valvePipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                /* TEST CODE */
+                var valve_handle = pipeline_handle.GetValve(null);
+
+                Assert.True(false, "DO NOT COME HERE!");
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else if (e is ArgumentException)
+                {
+                    Assert.Pass("ArgumentException: passed!");
+                }
+                else
+                {
+                    Assert.Fail("Unexpected Exception: failed..");
+                }
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check ArgumentException when controling valve with invalid name")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.Pipeline.GetValve M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("COVPARAM", "string")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public void GetValve_CHECK_ArgumentException_invalid_name()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create a pipeline instance
+                 */
+                var pipeline_handle = new Pipeline(_valvePipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                /* TEST CODE */
+                var valve_handle = pipeline_handle.GetValve("invalid_valve");
+                pipeline_handle.Dispose();
+
+                Assert.True(false, "DO NOT COME HERE!");
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else if (e is ArgumentException)
+                {
+                    Assert.Pass("ArgumentException: passed!");
+                }
+                else
+                {
+                    Assert.Fail("Unexpected Exception: failed..");
+                }
+            }
+        }
+    }
+}
diff --git a/tct-suite-vs/Tizen.MachineLearning.Inference.Tests/testcase/TSStateChangedEventArgs.cs b/tct-suite-vs/Tizen.MachineLearning.Inference.Tests/testcase/TSStateChangedEventArgs.cs
new file mode 100644 (file)
index 0000000..3bf14de
--- /dev/null
@@ -0,0 +1,121 @@
+/*
+ *  Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License
+ */
+
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using System.IO;
+using Tizen;
+using Tizen.System;
+using Tizen.MachineLearning.Inference;
+using System.Threading.Tasks;
+
+namespace Tizen.MachineLearning.Inference.Tests {
+    [TestFixture]
+    [Description("Tizen.MachineLearning.Inference.StateChangedEventArgs Tests")]
+    public class StateChangedEventArgsTests
+    {
+        private const string TAG = "Tizen.MachineLearning.Inference.Tests";
+        private const string FeatureKey = "http://tizen.org/feature/machine_learning.inference";
+        private const int SleepTime = 2000; // default sleep time to run the pipeline
+
+        private readonly string _generalPipeline = "videotestsrc is-live=true ! videoconvert ! valve name=valvex ! tensor_converter ! tensor_sink name=sinkx async=false";
+        private PipelineState _changedState;
+        private bool _isMachineLeanringInferenceSupported = false;
+
+        [SetUp]
+        public void Init()
+        {
+            LogUtils.Write(LogUtils.DEBUG, TAG, "Preconditions for Tizen.MachineLearning.Inference TEST");
+
+            Information.TryGetValue(FeatureKey, out _isMachineLeanringInferenceSupported);
+
+            if (!_isMachineLeanringInferenceSupported)
+            {
+                LogUtils.Write(LogUtils.DEBUG, TAG, "ML feature is not supported.");
+            }
+
+            _changedState = PipelineState.Null;
+        }
+
+        [TearDown]
+        public void Destroy()
+        {
+            LogUtils.Write(LogUtils.DEBUG, TAG, "Postconditions for Tizen.MachineLearning.Inference TEST");
+
+            if (_isMachineLeanringInferenceSupported)
+            {
+            }
+        }
+
+        private void StateChangedCallback(object sender, StateChangedEventArgs args)
+        {
+            Assert.IsNotNull(args, "Failed, EventArgs is null.");
+            _changedState = args.State;
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test State in StateChangedEventArgs")]
+        [Property("SPEC", "Tizen.MachineLearning.Inference.StateChangedEventArgs.State A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRO")]
+        [Property("AUTHOR", "Gichan Jang, gichan2.jang@samsung.com")]
+        public async Task State_Get()
+        {
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * - Create a pipeline instance
+                 */
+                var pipeline_handle = new Pipeline(_generalPipeline);
+                Assert.IsNotNull(pipeline_handle, "Failed to create pipeline instance");
+                Assert.IsInstanceOf<Pipeline>(pipeline_handle, "Should return pipeline instance");
+
+                /* TEST CODE */
+                pipeline_handle.StateChanged += StateChangedCallback;
+
+                pipeline_handle.Start();
+                await Task.Delay(SleepTime);
+
+                /* PLAYING after starting the pipeline */
+                Assert.IsTrue(_changedState == PipelineState.Playing);
+
+                pipeline_handle.Stop();
+                await Task.Delay(SleepTime);
+
+                /* PAUSED after stopping the pipeline */
+                Assert.IsTrue(_changedState == PipelineState.Paused);
+
+                pipeline_handle.StateChanged -= StateChangedCallback;
+                pipeline_handle.Dispose();
+            }
+            catch (Exception e)
+            {
+                if (e is NotSupportedException)
+                {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+                    Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+                }
+                else
+                {
+                    Assert.IsTrue(false, e.Message);
+                }
+            }
+        }
+    }
+}