[Mediacontent][TCSACR-249] Add face insert method 24/210024/4
authorHaesu Gwon <haesu.gwon@samsung.com>
Mon, 15 Jul 2019 05:50:20 +0000 (14:50 +0900)
committerHaesu Gwon <haesu.gwon@samsung.com>
Tue, 16 Jul 2019 03:36:54 +0000 (03:36 +0000)
Change-Id: Ie57f8d498538603351b737f6cc14aac1e7e37d3b

tct-suite-vs/Tizen.Mediacontent.Tests/testcase/TSFaceInfoCommand.cs [changed mode: 0755->0644]

old mode 100755 (executable)
new mode 100644 (file)
index 1a391b6..903c261
@@ -1,4 +1,4 @@
-using NUnit.Framework;
+using NUnit.Framework;
 using System;
 using System.Threading.Tasks;
 
@@ -299,5 +299,180 @@ namespace Tizen.Content.MediaContent.Tests
             Assert.That(_cmd.Delete("invalid_id"), Is.False);
         }
 
+        [Test]
+        [Category("P1")]
+        [Description("Insert face information to the database")]
+        [Property("SPEC", "Tizen.Content.MediaContent.FaceInfoCommand.Insert M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("COVPARAM", "string, Rectangle, Orientation")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void Insert_WITH_VALID_ID()
+        {
+            Assert.That(() => _cmd.Insert(_mediaId, new Rectangle(0, 0, 100, 100),
+                Orientation.Normal), Throws.Nothing);
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Throws ArgumentException if media id is invalid")]
+        [Property("SPEC", "Tizen.Content.MediaContent.FaceInfoCommand.Insert M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("COVPARAM", "string, Rectangle, Orientation")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void Insert_WITH_INVALID_ID()
+        {
+            Assert.That(() => _cmd.Insert("invalid_id", new Rectangle(0, 0, 100, 100),
+                Orientation.Normal), Throws.ArgumentException);
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Throws ArgumentException if media id is an empty string")]
+        [Property("SPEC", "Tizen.Content.MediaContent.FaceInfoCommand.Insert M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("COVPARAM", "string, Rectangle, Orientation")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void Insert_WITH_ID_EMPTY()
+        {
+            Assert.That(() => _cmd.Insert(" ", new Rectangle(0, 0, 100, 100),
+                Orientation.Normal), Throws.ArgumentException);
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Throws ArgumentNullException if media id is null")]
+        [Property("SPEC", "Tizen.Content.MediaContent.FaceInfoCommand.Insert M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("COVPARAM", "string, Rectangle, Orientation")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void Insert_WITH_ID_NULL()
+        {
+            Assert.That(() => _cmd.Insert(null, new Rectangle(0, 0, 100, 100),
+                Orientation.Normal), Throws.ArgumentNullException);
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Throws ObjectDisposedException if the database has already been disposed")]
+        [Property("SPEC", "Tizen.Content.MediaContent.FaceInfoCommand.Insert M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("COVPARAM", "string, Rectangle, Orientation")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void Insert_THROWS_IF_DB_DISPOSED()
+        {
+            _database.Dispose();
+
+            Assert.That(() => _cmd.Insert(_mediaId, new Rectangle(0, 0, 100, 100),
+                Orientation.Normal), Throws.TypeOf<ObjectDisposedException>());
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Throws InvalidOperationException if the database has already been disconnected")]
+        [Property("SPEC", "Tizen.Content.MediaContent.FaceInfoCommand.Insert M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("COVPARAM", "string, Rectangle, Orientation")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void Insert_THROWS_IF_DB_DISCONNECTED()
+        {
+            _database.Disconnect();
+
+            Assert.That(() => _cmd.Insert(_mediaId, new Rectangle(0, 0, 100, 100),
+                Orientation.Normal), Throws.InvalidOperationException);
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Insert face information to the database with tag")]
+        [Property("SPEC", "Tizen.Content.MediaContent.FaceInfoCommand.Insert M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("COVPARAM", "string, Rectangle, Orientation, string")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void Insert_WITH_TAG_AND_VALID_ID()
+        {
+            Assert.That(() => _cmd.Insert(_mediaId, new Rectangle(0, 0, 100, 100),
+                Orientation.Normal, "MyFace"), Throws.Nothing);
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Throws ArgumentException if media id is invalid")]
+        [Property("SPEC", "Tizen.Content.MediaContent.FaceInfoCommand.Insert M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("COVPARAM", "string, Rectangle, Orientation, string")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void Insert_WITH_TAG_AND_INVALID_ID()
+        {
+            Assert.That(() => _cmd.Insert("invalid_id", new Rectangle(0, 0, 100, 100),
+                Orientation.Normal, "MyFace"), Throws.ArgumentException);
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Throws ArgumentException if media id is an empty string")]
+        [Property("SPEC", "Tizen.Content.MediaContent.FaceInfoCommand.Insert M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("COVPARAM", "string, Rectangle, Orientation, string")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void Insert_WITH_TAG_AND_ID_EMPTY()
+        {
+            Assert.That(() => _cmd.Insert(" ", new Rectangle(0, 0, 100, 100),
+                Orientation.Normal, "MyFace"), Throws.ArgumentException);
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Throws ArgumentNullException if media id is null")]
+        [Property("SPEC", "Tizen.Content.MediaContent.FaceInfoCommand.Insert M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("COVPARAM", "string, Rectangle, Orientation, string")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void Insert_WITH_TAG_AND_ID_NULL()
+        {
+            Assert.That(() => _cmd.Insert(null, new Rectangle(0, 0, 100, 100),
+                Orientation.Normal, "MyFace"), Throws.ArgumentNullException);
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Throws ObjectDisposedException if the database has already been disposed")]
+        [Property("SPEC", "Tizen.Content.MediaContent.FaceInfoCommand.Insert M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("COVPARAM", "string, Rectangle, Orientation, string")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void Insert_WITH_TAG_THROWS_IF_DB_DISPOSED()
+        {
+            _database.Dispose();
+
+            Assert.That(() => _cmd.Insert(_mediaId, new Rectangle(0, 0, 100, 100),
+                Orientation.Normal, "MyFace"), Throws.TypeOf<ObjectDisposedException>());
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Throws InvalidOperationException if the database has already been disconnected")]
+        [Property("SPEC", "Tizen.Content.MediaContent.FaceInfoCommand.Insert M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("COVPARAM", "string, Rectangle, Orientation, string")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void Insert_WITH_TAG_THROWS_IF_DB_DISCONNECTED()
+        {
+            _database.Disconnect();
+
+            Assert.That(() => _cmd.Insert(_mediaId, new Rectangle(0, 0, 100, 100),
+                Orientation.Normal, "MyFace"), Throws.InvalidOperationException);
+        }
     }
 }