-using NUnit.Framework;
+using NUnit.Framework;
using System;
using System.Threading.Tasks;
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);
+ }
}
}