--- /dev/null
+using NUnit.Framework;
+
+namespace Tizen.Content.MediaContent.Tests
+{
+ [TestFixture]
+ [Description("Tizen.Content.MediaContent.BookInfo Tests")]
+ public class BookInfoTests : TestBase
+ {
+ private BookInfo _bookInfo;
+
+ [SetUp]
+ public void SetUp()
+ {
+ Log.Info("Tizen.Mediacontent.Tests", "Enter");
+ _bookInfo = new MediaInfoCommand(_database).Add(TestConstants.EbookFile) as BookInfo;
+
+ Assert.NotNull(_bookInfo, "Failed to get BookInfo");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test whether Subject Property returns expected value or not.")]
+ [Property("SPEC", "Tizen.Content.MediaContent.BookInfo.Subject A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Subject_PROPERTY_READ_ONLY()
+ {
+ Log.Info("Tizen.Mediacontent.Tests", "Enter");
+ Assert.That(_bookInfo.Subject, Is.EqualTo("fiction"));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test whether Author Property returns expected value or not.")]
+ [Property("SPEC", "Tizen.Content.MediaContent.BookInfo.Author A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Author_PROPERTY_READ_ONLY()
+ {
+ Assert.That(_bookInfo.Author, Is.EqualTo("creator"));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test whether DatePublished Property returns expected value or not.")]
+ [Property("SPEC", "Tizen.Content.MediaContent.BookInfo.DatePublished A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void DatePublished_PROPERTY_READ_ONLY()
+ {
+ Assert.That(_bookInfo.DatePublished, Is.EqualTo("2021"));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test whether Publisher Property returns expected value or not.")]
+ [Property("SPEC", "Tizen.Content.MediaContent.BookInfo.Publisher A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Publisher_PROPERTY_READ_ONLY()
+ {
+ Assert.That(_bookInfo.Publisher, Is.EqualTo("publisher"));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test whether MediaType Property returns expected value or not.")]
+ [Property("SPEC", "Tizen.Content.MediaContent.BookInfo.MediaType A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void MediaType_PROPERTY_READ_ONLY()
+ {
+ Assert.That(_bookInfo.MediaType, Is.EqualTo(MediaType.Book));
+ }
+ }
+}
\ No newline at end of file
+using System.Runtime.CompilerServices;
+using System.Xml.Linq;
using NUnit.Framework;
using System;
using System.Collections.Generic;
}
[Test]
+ [Category("P1")]
+ [Description("Returns BookInfo containing result filtered")]
+ [Property("SPEC", "Tizen.Content.MediaContent.MediaInfoCommand.SelectMedia M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("COVPARAM", "SelectArguments")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void SelectMedia_WITH_MediaType_Book()
+ {
+ var id = _cmd.Add(TestConstants.EbookFile).Id;
+
+ var bookInfo = _cmd.SelectMedia(id) as BookInfo;
+
+ Assert.That(bookInfo.Subject, Is.EqualTo("fiction"),
+ "Should return same value");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test whether SelectEbookPath method throws exception or not")]
+ [Property("SPEC", "Tizen.Content.MediaContent.MediaInfoCommand.SelectEbookPath M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void SelectEbookPath_CHECK_RETURN()
+ {
+ Assert.That(() => _cmd.SelectEbookPath("test"), Throws.Nothing,
+ "Should not throws exception");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test whether returns MediaDataReader containing ebook path or not")]
+ [Property("SPEC", "Tizen.Content.MediaContent.MediaInfoCommand.SelectEbookPath M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void SelectEbookPath_CHECK_RETURN_EXPECTED_VALUE()
+ {
+ var reader = _cmd.SelectEbookPath("test");
+ reader.Read();
+
+ Assert.That(reader.Current.Contains("ebook.epub"), "Should return proper value");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Throws if argument is null")]
+ [Property("SPEC", "Tizen.Content.MediaContent.MediaInfoCommand.SelectEbookPath M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void SelectEbookPath_THROWS_IF_KEYWORD_NULL()
+ {
+ Assert.That(() => _cmd.SelectEbookPath(null), Throws.ArgumentNullException,
+ "Should throws ArgumentNullException exception");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Throws if the database has already been disconnected.")]
+ [Property("SPEC", "Tizen.Content.MediaContent.MediaInfoCommand.SelectEbookPath M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void SelectEbookPath_THROWS_IF_DB_DISCONNECTED()
+ {
+ _database.Disconnect();
+ Assert.That(() => _cmd.SelectEbookPath("test"), Throws.InvalidOperationException,
+ "Should throws InvalidOperationException exception");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Throws if the database has already been disposed.")]
+ [Property("SPEC", "Tizen.Content.MediaContent.MediaInfoCommand.SelectEbookPath M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void SelectEbookPath_THROWS_IF_DB_DISPOSED()
+ {
+ _database.Dispose();
+ Assert.That(() => _cmd.SelectEbookPath("test"), Throws.TypeOf<ObjectDisposedException>(),
+ "Should throws ObjectDisposedException exception");
+ }
+
+ [Test]
[Category("P2")]
[Description("Throws if the database has already been disconnected")]
[Property("SPEC", "Tizen.Content.MediaContent.MediaInfoCommand.CountGroupBy M")]
{
{ TestConstants.AudioFile, TestConstants.AudioFileBackup},
{ TestConstants.VideoFile, TestConstants.VideoFileBackup },
+ { TestConstants.EbookFile, TestConstants.EbookFileBackup },
{ TestConstants.ImageFile, TestConstants.ImageFileBackup },
{ TestConstants.ImageFileForFolder, TestConstants.ImageFileForFolderBackup }
};
{
{ TestConstants.AudioFileBackup, TestConstants.AudioFile},
{ TestConstants.VideoFileBackup, TestConstants.VideoFile },
+ { TestConstants.EbookFileBackup, TestConstants.EbookFile },
{ TestConstants.ImageFileBackup, TestConstants.ImageFile },
{ TestConstants.ImageFileForFolderBackup, TestConstants.ImageFileForFolder }
};
internal static readonly string FaceImageFileUnSupported = RootPath + "/face_image_unsupported.gif";
internal static readonly string AudioFile = RootPath + "/sound.mp3";
internal static readonly string VideoFile = RootPath + "/movie.mp4";
+ internal static readonly string EbookFile = RootPath + "/ebook.epub";
internal static readonly string PlaylistFile = RootPath + "/tmp.m3u";
internal static readonly string FolderPath = RootPath + "/test";
internal static readonly string ImageFileForFolder = FolderPath + "/test.jpg";
internal static readonly string FaceImageFileBackup = RootPath + "/face_image.bak";
internal static readonly string AudioFileBackup = RootPath + "/sound.bak";
internal static readonly string VideoFileBackup = RootPath + "/movie.bak";
+ internal static readonly string EbookFileBackup = RootPath + "/ebook.bak";
internal static readonly string PlaylistFileBackup = RootPath + "/tmp.bak";
internal static readonly string ImageFileForFolderBackup = FolderPath + "/test.bak";
internal static readonly string OtherFileBackup = OtherPath + "/other.bak";