--- /dev/null
+using NUnit.Framework;
+using System.Linq;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Tizen.Applications;
+
+namespace Tizen.Multimedia.Remoting.Tests
+{
+ [TestFixture]
+ [Description("Testing Tizen.Multimedia.Remoting.Command class")]
+ public class CommandTests
+ {
+ private MediaController _controller;
+ private MediaControllerManager _manager;
+
+ // Command class is abstract so we need to test with derived class.
+ private SearchCommand _command;
+
+ [SetUp]
+ public void SetUp()
+ {
+ MediaControlServer.Start();
+
+ _manager = new MediaControllerManager();
+ _controller = _manager.GetActiveControllers().Single(
+ c => c.ServerAppId == Application.Current.ApplicationInfo.ApplicationId);
+ _command = new SearchCommand(new MediaControlSearchCondition(MediaControlContentType.Image, "test", null));
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ if (MediaControlServer.IsRunning)
+ {
+ MediaControlServer.Stop();
+ }
+
+ _manager.Dispose();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Create SearchCommand instance")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.Command.Command C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Command_CHECK_CREATE_CONSTRUCTOR()
+ {
+ Assert.IsNotNull(_command, "Object should not be null after initializing");
+ Assert.IsInstanceOf<SearchCommand>(_command, "Should return SearchCommand instance");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check whether client and server communicate correctly using OnResponseCompleted internally.")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.Command.OnResponseCompleted M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public async Task OnResponseCompleted_AFTER_RESPONSE()
+ {
+ SearchCommand searchCommand = null;
+
+ MediaControlServer.SearchCommandReceived += (s, e) =>
+ {
+ searchCommand = e.Command;
+
+ Assert.That(() => MediaControlServer.Response(searchCommand, 0, new Bundle()), Throws.Nothing);
+ };
+
+ await Task.Run(() =>
+ {
+ _controller.RequestAsync(_command);
+ });
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check whether client and server communicate correctly using ReceiverId internally.")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.Command.ReceiverId A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public async Task ReceiverId_WITH_RESPONSE()
+ {
+ SearchCommand searchCommand = null;
+
+ MediaControlServer.SearchCommandReceived += (s, e) =>
+ {
+ searchCommand = e.Command;
+
+ // protected ReceiverId is called in MediaControlServer.Response().
+ Assert.That(() => MediaControlServer.Response(searchCommand, 0, new Bundle()), Throws.Nothing);
+ };
+
+ await Task.Run(() =>
+ {
+ _controller.RequestAsync(_command);
+ });
+ }
+ }
+}
--- /dev/null
+using NUnit.Framework;
+using System;
+using System.Linq;
+using Tizen.Applications;
+
+namespace Tizen.Multimedia.Remoting.Tests
+{
+ [TestFixture]
+ [Description("Testing Tizen.Multimedia.Remoting.CustomCommand class")]
+ public class CustomCommandTests
+ {
+ private MediaController _controller;
+ private MediaControllerManager _manager;
+ private CustomCommand _command;
+ private string _action = "test";
+
+ [SetUp]
+ public void SetUp()
+ {
+ MediaControlServer.Start();
+
+ _manager = new MediaControllerManager();
+ _controller = _manager.GetActiveControllers().Single(
+ c => c.ServerAppId == Application.Current.ApplicationInfo.ApplicationId);
+ _command = new CustomCommand(_action);
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ if (MediaControlServer.IsRunning)
+ {
+ MediaControlServer.Stop();
+ }
+
+ _manager.Dispose();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Create CustomCommand instance")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.CustomCommand.CustomCommand C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("COVPARAM", "string")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void CustomCommand_CHECK_CREATE_CONSTRUCTOR()
+ {
+ Assert.IsNotNull(_command, "Object should not be null after initializing");
+ Assert.IsInstanceOf<CustomCommand>(_command, "Should return CustomCommand instance");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Create CustomCommand instance")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.CustomCommand.CustomCommand C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("COVPARAM", "string, Bundle")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void CustomCommand_CHECK_CREATE_CONSTRUCTOR_WITH_BUNDLE()
+ {
+ var command = new CustomCommand("test", new Bundle());
+ Assert.IsNotNull(command, "Object should not be null after initializing");
+ Assert.IsInstanceOf<CustomCommand>(command, "Should return CustomCommand instance");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether PlaylistCommand throws exception if parameter is invalid")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.CustomCommand.CustomCommand C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTN")]
+ [Property("COVPARAM", "string")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void CustomCommand_THROWS_EXCEPTION()
+ {
+ Assert.Throws<ArgumentNullException>(() => new CustomCommand(null));
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether PlaylistCommand throws exception if parameter is invalid")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.CustomCommand.CustomCommand C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTN")]
+ [Property("COVPARAM", "string, Bundle")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void CustomCommand_WITH_BUNDLE_THROWS_EXCEPTION()
+ {
+ Assert.Throws<ArgumentNullException>(() => new CustomCommand(null, null));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check whether Action property is null or not.")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.CustomCommand.Action A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Action_READ_ONLY()
+ {
+ Assert.That(_command.Action, Is.TypeOf<string>());
+ Assert.That(() => _command.Action, Is.EqualTo(_action));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check whether Bundle property is null or not.")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.CustomCommand.Bundle A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Bundle_READ_ONLY()
+ {
+ var bundle = new Bundle();
+ bundle.AddItem("test_key", "test_value");
+
+ var command = new CustomCommand("test", bundle);
+ Assert.That(command.Bundle, Is.TypeOf<Bundle>());
+ Assert.That(() => command.Bundle.GetItem("test_key"), Is.EqualTo("test_value"));
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using NUnit.Framework;
+using System;
+
+namespace Tizen.Multimedia.Remoting.Tests
+{
+ [TestFixture]
+ [Description("Testing Tizen.Multimedia.Remoting.CustomCommandReceivedEventArgs class")]
+ public class CustomCommandReceivedEventArgsTests
+ {
+ [Test]
+ [Category("P1")]
+ [Description("Create CustomCommandReceivedEventArgs instance")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.CustomCommandReceivedEventArgs.CustomCommandReceivedEventArgs C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void CustomCommandReceivedEventArgs_CONSTRUCTOR()
+ {
+ Assert.That(() => new CustomCommandReceivedEventArgs(new CustomCommand("test")), Throws.Nothing);
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether constructor throw exeption or not, when creating instance with null parameter.")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.CustomCommandReceivedEventArgs.CustomCommandReceivedEventArgs C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTN")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void CustomCommandReceivedEventArgs_CONSTRUCTOR_CHECK_EXCEPTION()
+ {
+ Assert.Throws<ArgumentNullException>(() => new CustomCommandReceivedEventArgs(null));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check whether Command property is null or not.")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.CustomCommandReceivedEventArgs.Command A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Command_READ_ONLY()
+ {
+ var args = new CustomCommandReceivedEventArgs(new CustomCommand("test"));
+
+ Assert.IsInstanceOf<CustomCommand>(args.Command);
+ Assert.That(() => args.Command.Action, Is.EqualTo("test"));
+ }
+ }
+}
--- /dev/null
+using NUnit.Framework;
+using System.Linq;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Tizen.Applications;
+
+namespace Tizen.Multimedia.Remoting.Tests
+{
+ [TestFixture]
+ [Description("Testing Tizen.Multimedia.Remoting.MediaControlPlaylist class")]
+ public class MediaControlPlaylistTests
+ {
+ private MediaController _controller;
+ private MediaControllerManager _manager;
+
+ [SetUp]
+ public void SetUp()
+ {
+ MediaControlServer.Start();
+
+ _manager = new MediaControllerManager();
+ _controller = _manager.GetActiveControllers().Single(
+ c => c.ServerAppId == Application.Current.ApplicationInfo.ApplicationId);
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ if (MediaControlServer.IsRunning)
+ {
+ MediaControlServer.Stop();
+ }
+
+ _manager.Dispose();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Create MediaControlPlaylist instance")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlPlaylist.MediaControlPlaylist C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("COVPARAM", "string")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void MediaControlPlaylist_CHECK_CREATE_CONSTRUCTOR()
+ {
+ using (var playlist = new MediaControlPlaylist("MyFavorite"))
+ {
+ Assert.IsNotNull(playlist, "Object should not be null after initializing");
+ Assert.IsInstanceOf<MediaControlPlaylist>(playlist, "Should return MediaControlPlaylist instance");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Create MediaControlPlaylist instance")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlPlaylist.MediaControlPlaylist C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("COVPARAM", "string, Dictionary<string, Tizen.Multimedia.Remoting.MediaControlMetadata>")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void MediaControlPlaylist_CHECK_CREATE_CONSTRUCTOR_WITH_METADATA()
+ {
+ using (var playlist = new MediaControlPlaylist("MyFavorite2",
+ new Dictionary<string, MediaControlMetadata>()
+ {
+ {"Song1", new MediaControlMetadata()},
+ {"Song2", new MediaControlMetadata()}
+ }))
+ {
+ Assert.IsNotNull(playlist, "Object should not be null after initializing");
+ Assert.IsInstanceOf<MediaControlPlaylist>(playlist, "Should return MediaControlPlaylist instance");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check whether Name returns expected value or not.")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlPlaylist.Name A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Name_READ_ONLY()
+ {
+ using (var playlist = new MediaControlPlaylist("MyFavorite"))
+ {
+ Assert.That(playlist.Name, Is.EqualTo("MyFavorite"));
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check whether TotalCount returns expected value or not.")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlPlaylist.TotalCount A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void TotalCount_READ_ONLY()
+ {
+ using (var playlist = new MediaControlPlaylist("MyFavorite"))
+ {
+ playlist.AddMetadata("Song1", new MediaControlMetadata());
+
+ Assert.That(playlist.TotalCount, Is.GreaterThan(0));
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets the metadata and compare with metadata added. ")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlPlaylist.GetMetadata M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void GetMetadata_RETURN_VALUE()
+ {
+ using (var playlist = new MediaControlPlaylist("MyFavorite"))
+ {
+ var metadatasPair = new Dictionary<string, MediaControlMetadata>()
+ {
+ {"ID1", new MediaControlMetadata() { Artist = "GD" } },
+ {"ID2", new MediaControlMetadata() { Artist = "BeWHY"} }
+ };
+
+ playlist.AddMetadata(metadatasPair);
+
+ Assert.That(playlist.GetMetadata(), Is.EqualTo(metadatasPair));
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets the metadata with index and compare with metadata added. ")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlPlaylist.GetMetadata M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("COVPARAM", "string")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void GetMetadata_RETURN_VALUE_WITH_STRING()
+ {
+ using (var playlist = new MediaControlPlaylist("MyFavorite"))
+ {
+ var metadata = new MediaControlMetadata()
+ {
+ Artist = "GD",
+ Album = "GoodBoy"
+ };
+
+ playlist.AddMetadata("ID1", metadata);
+
+ Assert.That(playlist.GetMetadata("ID1"), Is.EqualTo(metadata));
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Adds the metadata and then, get and compare with metadata added. ")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlPlaylist.AddMetadata M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("COVPARAM", "Dictionary<string, Tizen.Multimedia.Remoting.MediaControlMetadata>")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void AddMetadata_RETURN_VALUE()
+ {
+ using (var playlist = new MediaControlPlaylist("MyFavorite"))
+ {
+ var metadatasPair = new Dictionary<string, MediaControlMetadata>()
+ {
+ {"ID1", new MediaControlMetadata() { Artist = "GD" } },
+ {"ID2", new MediaControlMetadata() { Artist = "BeWHY"} }
+ };
+
+ playlist.AddMetadata(metadatasPair);
+
+ Assert.That(playlist.GetMetadata(), Is.EqualTo(metadatasPair));
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Adds the metadata with index and then, get and compare with metadata added. ")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlPlaylist.AddMetadata M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("COVPARAM", "string, MediaControlMetadata")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void AddMetadata_RETURN_VALUE_WITH_STRING()
+ {
+ using (var playlist = new MediaControlPlaylist("MyFavorite"))
+ {
+ var metadata = new MediaControlMetadata()
+ {
+ Artist = "GD",
+ Album = "GoodBoy"
+ };
+
+ playlist.AddMetadata("ID1", metadata);
+
+ Assert.That(playlist.GetMetadata("ID1"), Is.EqualTo(metadata));
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Returns value set by the server")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlPlaylist.Update M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Update_RETURN_VALUE()
+ {
+ using (var playlist = new MediaControlPlaylist("MyFavorite"))
+ {
+ var metadata = new MediaControlMetadata()
+ {
+ Artist = "GD",
+ Album = "GoodBoy"
+ };
+
+ playlist.AddMetadata("ID1", metadata);
+
+ Assert.That(playlist.GetMetadata("ID1"), Is.EqualTo(metadata));
+ }
+ }
+ }
+}
\ No newline at end of file
using NUnit.Framework;
+using System;
using System.Linq;
-using System.Collections.Generic;
-using System.Threading.Tasks;
using Tizen.Applications;
namespace Tizen.Multimedia.Remoting.Tests
private MediaController _controller;
private MediaControllerManager _manager;
private MediaControlSearchCondition _condition;
+ private Bundle _bundle = new Bundle();
[SetUp]
public void SetUp()
_controller = _manager.GetActiveControllers().Single(
c => c.ServerAppId == Application.Current.ApplicationInfo.ApplicationId);
_condition = new MediaControlSearchCondition(MediaControlContentType.Image,
- MediaControlSearchCategory.Artist, "GD", new Bundle());
+ MediaControlSearchCategory.Artist, "GD", _bundle);
}
[TearDown]
[Test]
[Category("P1")]
- [Description("Create MediaControlSearchCondition instance")]
+ [Description("Create MediaControlSearchCondition instance with content type, category, keyword and buldle")]
[Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlSearchCondition.MediaControlSearchCondition C")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "CONSTR")]
}
[Test]
+ [Category("P2")]
+ [Description("Check whether MediaControlSearchCondition throws exception if parameter is invalid")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlSearchCondition.MediaControlSearchCondition C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTN")]
+ [Property("COVPARAM", "MediaControlContentType, MediaControlSearchCategory, string, Bundle")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void MediaControlSearchCondition_THROWS_EXCEPTION()
+ {
+ Assert.Throws<ArgumentException>(() => new MediaControlSearchCondition(MediaControlContentType.Image - 1,
+ MediaControlSearchCategory.Artist, "GD", new Bundle()));
+ Assert.Throws<ArgumentException>(() => new MediaControlSearchCondition(MediaControlContentType.NotDecided + 1,
+ MediaControlSearchCategory.Artist, "GD", new Bundle()));
+
+ Assert.Throws<ArgumentException>(() => new MediaControlSearchCondition(MediaControlContentType.Image,
+ MediaControlSearchCategory.All - 1, "GD", new Bundle()));
+ Assert.Throws<ArgumentException>(() => new MediaControlSearchCondition(MediaControlContentType.Image,
+ MediaControlSearchCategory.Tpo + 1, "GD", new Bundle()));
+
+ Assert.Throws<ArgumentNullException>(() => new MediaControlSearchCondition(MediaControlContentType.Image,
+ MediaControlSearchCategory.Artist, null, new Bundle()));
+ }
+
+ [Test]
[Category("P1")]
- [Description("Create MediaControlSearchCondition instance")]
+ [Description("Create MediaControlSearchCondition instance with content type, keyword, buldle and all category")]
[Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlSearchCondition.MediaControlSearchCondition C")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "CONSTR")]
}
[Test]
+ [Category("P2")]
+ [Description("Check whether MediaControlSearchCondition throws exception if parameter is invalid")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlSearchCondition.MediaControlSearchCondition C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTN")]
+ [Property("COVPARAM", "MediaControlContentType, string, Bundle")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void MediaControlSearchCondition_WITH_ALL_CATEGORY_THROWS_EXCEPTION()
+ {
+ Assert.Throws<ArgumentException>(() => new MediaControlSearchCondition(MediaControlContentType.Image - 1,
+ "GD", new Bundle()));
+ Assert.Throws<ArgumentException>(() => new MediaControlSearchCondition(MediaControlContentType.NotDecided + 1,
+ "GD", new Bundle()));
+
+ Assert.Throws<ArgumentNullException>(() => new MediaControlSearchCondition(MediaControlContentType.Image,
+ null, new Bundle()));
+ }
+
+ [Test]
[Category("P1")]
- [Description("Is always not null")]
+ [Description("Check whether ContentType property is type of MediaControlContentType or not.")]
[Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlSearchCondition.ContentType A")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "PRO")]
[Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
public void ContentType_READ_ONLY()
{
- Assert.That(() => _condition.ContentType, Is.Not.Null);
+ Assert.IsInstanceOf<MediaControlContentType>(_condition.ContentType);
+ Assert.That(_condition.ContentType, Is.EqualTo(MediaControlContentType.Image));
}
[Test]
[Category("P1")]
- [Description("Is always not null")]
+ [Description("Check whether Category property is type of MediaControlSearchCategory or not.")]
[Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlSearchCondition.Category A")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "PRO")]
[Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
public void Category_READ_ONLY()
{
- Assert.That(() => _condition.Category, Is.Not.Null);
+ Assert.IsInstanceOf<MediaControlSearchCategory>(_condition.Category);
+ Assert.That(_condition.Category, Is.EqualTo(MediaControlSearchCategory.Artist));
}
[Test]
[Category("P1")]
- [Description("Is always not null")]
+ [Description("Check whether Keyword property is type of string or not.")]
[Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlSearchCondition.Keyword A")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "PRO")]
[Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
public void Keyword_READ_ONLY()
{
- Assert.That(() => _condition.Keyword, Is.Not.Null);
+ Assert.IsInstanceOf<string>(_condition.Keyword);
+ Assert.That(_condition.Keyword, Is.EqualTo("GD"));
}
[Test]
[Category("P1")]
- [Description("Is always not null")]
+ [Description("Check whether Bundle property is type of Bundle or not.")]
[Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlSearchCondition.Bundle A")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "PRO")]
[Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
public void Bundle_READ_ONLY()
{
- Assert.That(() => _condition.Bundle, Is.Not.Null);
+ Assert.IsInstanceOf<Bundle>(_condition.Bundle);
+ Assert.That(_condition.Bundle, Is.EqualTo(_bundle));
}
}
}
using NUnit.Framework;
using System;
using System.Linq;
+using System.Collections.Generic;
using System.Threading.Tasks;
using Tizen.Applications;
+using Tizen.Internals.Errors;
namespace Tizen.Multimedia.Remoting.Tests
{
{
Assert.That(MediaControlServer.IsRunning, Is.True);
}
+
+ [Test]
+ [Category("P1")]
+ [Description("Test for getting activated client list")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.GetActivatedClients M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void GetActivatedClients_RETURN_VALUE()
+ {
+ using (var manager = new MediaControllerManager())
+ {
+ var mediaController = manager.GetActiveControllers().Single(
+ c => c.ServerAppId == Application.Current.ApplicationInfo.ApplicationId);
+
+ foreach (var controller in MediaControlServer.GetActivatedClients())
+ {
+ //Assert.That(controller, Is.Not.Null);
+ Assert.That(controller, Is.EqualTo(Application.Current.ApplicationInfo.ApplicationId));
+ }
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test for removing playlist")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.RemovePlaylist M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void RemovePlaylist_RETURN_VALUE()
+ {
+ var playlist = new MediaControlPlaylist("MyFavor");
+
+ Assert.That(() => MediaControlServer.RemovePlaylist(playlist), Throws.Nothing);
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether RemovePlaylist throws exception if parameter is invalid")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.RemovePlaylist M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void RemovePlaylist_THROWS_EXCEPTION()
+ {
+ Assert.Throws<ArgumentNullException>(() => MediaControlServer.RemovePlaylist(null));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Thows nothing when RequestAsync to client")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.RequestAsync M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public async Task RequestAsync_RETURN_VALUE()
+ {
+ using (var manager = new MediaControllerManager())
+ {
+ var controller = manager.GetActiveControllers().Single(
+ c => c.ServerAppId == Application.Current.ApplicationInfo.ApplicationId);
+ CustomCommand customCommand = null;
+
+ controller.CustomCommandReceived += (s, e) =>
+ {
+ customCommand = e.Command;
+
+ controller.Response(customCommand, 0);
+ };
+
+ await Task.Run(() =>
+ {
+ Assert.That(() => MediaControlServer.RequestAsync(new CustomCommand("CustomCommand"),
+ Application.Current.ApplicationInfo.ApplicationId), Throws.Nothing);
+ });
+ }
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether RequestAsync throws exception if client response with error")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.RequestAsync M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public async Task RequestAsync_THROWS_EXCEPTION()
+ {
+ using (var manager = new MediaControllerManager())
+ {
+ var controller = manager.GetActiveControllers().Single(
+ c => c.ServerAppId == Application.Current.ApplicationInfo.ApplicationId);
+ CustomCommand customCommand = null;
+
+ controller.CustomCommandReceived += (s, e) =>
+ {
+ customCommand = e.Command;
+
+ controller.Response(customCommand, (int)ErrorCode.InvalidOperation);
+ };
+
+ await Task.Run(() =>
+ {
+ Assert.That(() => MediaControlServer.RequestAsync(new CustomCommand("CustomCommand"),
+ Application.Current.ApplicationInfo.ApplicationId), Throws.InvalidOperationException);
+ });
+ }
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether RequestAsync throws exception if parameter is null")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.RequestAsync M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void RequestAsync_WITH_NULL_THROWS_EXCEPTION()
+ {
+ Assert.ThrowsAsync<ArgumentNullException>(() => MediaControlServer.RequestAsync(null,
+ Application.Current.ApplicationInfo.ApplicationId));
+
+ Assert.ThrowsAsync<ArgumentNullException>(() => MediaControlServer.RequestAsync(
+ new CustomCommand("CustomCommand"), null));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Thows nothing when response to client")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.Response M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("COVPARAM", "Command, int, Bundle")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public async Task Response_WITH_BUNDLE_THROWS_NOTHING()
+ {
+ using (var manager = new MediaControllerManager())
+ {
+ var controller = manager.GetActiveControllers().Single(
+ c => c.ServerAppId == Application.Current.ApplicationInfo.ApplicationId);
+
+ EventHandler<CustomCommandReceivedEventArgs> eventHandler = (s, e) =>
+ {
+ var customCommand = e.Command;
+
+ Assert.That(() => MediaControlServer.Response(customCommand, 0, new Bundle()), Throws.Nothing);
+ };
+
+ try
+ {
+ MediaControlServer.CustomCommandReceived += eventHandler;
+
+ await Task.Run(() =>
+ {
+ Assert.That(() => controller.RequestAsync(new CustomCommand("Custom")), Throws.Nothing);
+ });
+ }
+ finally
+ {
+ MediaControlServer.CustomCommandReceived -= eventHandler;
+ }
+ }
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether Response throws exception if server is not working")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.Response M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "Command, int, Bundle")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Response_WITH_BUNDLE_THROWS_EXCEPTION()
+ {
+ MediaControlServer.Stop();
+
+ Assert.That(() => MediaControlServer.Response(new CustomCommand("custom"), 0, new Bundle()),
+ Throws.InvalidOperationException);
+
+ Assert.Throws<ArgumentNullException>(() => MediaControlServer.Response(null, 0, new Bundle()));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Thows nothing when response to client")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.Response M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("COVPARAM", "Command, int")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public async Task Response_THROWS_NOTHING()
+ {
+ using (var manager = new MediaControllerManager())
+ {
+ var controller = manager.GetActiveControllers().Single(
+ c => c.ServerAppId == Application.Current.ApplicationInfo.ApplicationId);
+
+ EventHandler<CustomCommandReceivedEventArgs> eventHandler = (s, e) =>
+ {
+ var customCommand = e.Command;
+
+ Assert.That(() => MediaControlServer.Response(customCommand, 0), Throws.Nothing);
+ };
+
+ try
+ {
+ MediaControlServer.CustomCommandReceived += eventHandler;
+
+ await Task.Run(() =>
+ {
+ Assert.That(() => controller.RequestAsync(new CustomCommand("Custom")), Throws.Nothing);
+ });
+ }
+ finally
+ {
+ MediaControlServer.CustomCommandReceived -= eventHandler;
+ }
+ }
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether Response throws exception if server is not working")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.Response M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "Command, int")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Response_THROWS_EXCEPTION()
+ {
+ MediaControlServer.Stop();
+
+ Assert.That(() => MediaControlServer.Response(new CustomCommand("custom"), 0),
+ Throws.InvalidOperationException);
+
+ Assert.Throws<ArgumentNullException>(() => MediaControlServer.Response(null, 0));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Returns index of current playing media")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.SetIndexOfCurrentPlayingMedia M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void SetIndexOfCurrentPlayingMedia_RETURN_VALUE()
+ {
+ using (var manager = new MediaControllerManager())
+ {
+ var controller = manager.GetActiveControllers().Single(
+ c => c.ServerAppId == Application.Current.ApplicationInfo.ApplicationId);
+
+ var index = "ID1";
+ Assert.That(() => MediaControlServer.SetIndexOfCurrentPlayingMedia(index), Throws.Nothing);
+
+ Assert.That(controller.GetIndexOfCurrentPlayingMedia(), Is.EqualTo(index));
+ }
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether SetIndexOfCurrentPlayingMedia throws exception if index is null")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.SetIndexOfCurrentPlayingMedia M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void SetIndexOfCurrentPlayingMedia_THROWS_EXCEPTION()
+ {
+ Assert.Throws<ArgumentNullException>(() => MediaControlServer.SetIndexOfCurrentPlayingMedia(null));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Sets age rating and get and compare with value")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.SetAgeRating M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void SetAgeRating_RETURN_VALUE()
+ {
+ using (var manager = new MediaControllerManager())
+ {
+ var controller = manager.GetActiveControllers().Single(
+ c => c.ServerAppId == Application.Current.ApplicationInfo.ApplicationId);
+
+ var ageRating = 12;
+ Assert.That(() => MediaControlServer.SetAgeRating(ageRating), Throws.Nothing);
+
+ Assert.That(controller.GetAgeRatingOfCurrentPlayingMedia(), Is.EqualTo(ageRating));
+ }
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether SetAgeRating throws exception if ageRating is in invalid range")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.SetAgeRating M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void SetAgeRating_THROWS_EXCEPTION()
+ {
+ Assert.Throws<ArgumentOutOfRangeException>(() => MediaControlServer.SetAgeRating(-1));
+
+ Assert.Throws<ArgumentOutOfRangeException>(() => MediaControlServer.SetAgeRating(20));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Sets icon path and get it and compare with value previosly set")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.SetIconPath M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void SetIconPath_RETURN_VALUE()
+ {
+ using (var manager = new MediaControllerManager())
+ {
+ var controller = manager.GetActiveControllers().Single(
+ c => c.ServerAppId == Application.Current.ApplicationInfo.ApplicationId);
+
+ var iconPath = "test.jpg";
+ Assert.That(() => MediaControlServer.SetIconPath(iconPath), Throws.Nothing);
+
+ Assert.That(controller.GetIconPath(), Is.EqualTo(iconPath));
+ }
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether SetIconPath throws exception if path is null")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.SetIconPath M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void SetIconPath_THROWS_EXCEPTION()
+ {
+ Assert.Throws<ArgumentNullException>(() => MediaControlServer.SetIconPath(null));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Sets playlist name and index of currnet playing media")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.SetInfoOfCurrentPlayingMedia M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void SetInfoOfCurrentPlayingMedia_RETURN_VALUE()
+ {
+ using (var manager = new MediaControllerManager())
+ using (var playlist1 = new MediaControlPlaylist("MyFavor",
+ new Dictionary<string, MediaControlMetadata>() { { "Song1", new MediaControlMetadata() } }))
+ using (var playlist2 = new MediaControlPlaylist("Classic",
+ new Dictionary<string, MediaControlMetadata>() { { "Song2", new MediaControlMetadata() } }))
+ {
+ var controller = manager.GetActiveControllers().Single(
+ c => c.ServerAppId == Application.Current.ApplicationInfo.ApplicationId);
+
+ var playlistName = "Classic";
+ var index = "Song2";
+ MediaControlServer.SetInfoOfCurrentPlayingMedia(playlistName, index);
+
+ Assert.That(controller.GetPlaylistOfCurrentPlayingMedia().Name, Is.EqualTo(playlistName));
+ }
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether SetInfoOfCurrentPlayingMedia throws exception if parameter is null")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.SetInfoOfCurrentPlayingMedia M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void SetInfoOfCurrentPlayingMedia_THROW_EXCEPTION()
+ {
+ Assert.Throws<ArgumentNullException>(() => MediaControlServer.SetInfoOfCurrentPlayingMedia("MyFavor", null));
+
+ Assert.Throws<ArgumentNullException>(() => MediaControlServer.SetInfoOfCurrentPlayingMedia(null, "ID1"));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Sets playback capability and get it and compare with the value")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.SetPlaybackCapability M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void SetPlaybackCapability_RETURN_VALUE()
+ {
+ using (var manager = new MediaControllerManager())
+ {
+ var controller = manager.GetActiveControllers().Single(
+ c => c.ServerAppId == Application.Current.ApplicationInfo.ApplicationId);
+
+ MediaControlServer.SetPlaybackCapability(MediaControlPlaybackCommand.FastForward,
+ MediaControlCapabilitySupport.NotSupported);
+
+ Assert.That(controller.GetPlaybackCapability(MediaControlPlaybackCommand.FastForward),
+ Is.EqualTo(MediaControlCapabilitySupport.NotSupported));
+ }
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether SetPlaybackCapability throws exception if parameter is invalid")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.SetPlaybackCapability M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void SetPlaybackCapability_THROWS_NOTHING()
+ {
+ Assert.Throws<ArgumentException>(() => MediaControlServer.SetPlaybackCapability(
+ MediaControlPlaybackCommand.Play - 1, MediaControlCapabilitySupport.NotSupported));
+
+ Assert.Throws<ArgumentException>(() => MediaControlServer.SetPlaybackCapability(
+ MediaControlPlaybackCommand.Toggle + 1, MediaControlCapabilitySupport.NotSupported));
+
+ Assert.Throws<ArgumentException>(() => MediaControlServer.SetPlaybackCapability(
+ MediaControlPlaybackCommand.Play, MediaControlCapabilitySupport.NotDecided));
+
+ Assert.Throws<ArgumentException>(() => MediaControlServer.SetPlaybackCapability(
+ MediaControlPlaybackCommand.Play, MediaControlCapabilitySupport.Supported - 1));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Sets playback capabilities without exception")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.SetPlaybackCapabilities M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void SetPlaybackCapabilities_RETURN_VALUE()
+ {
+ using (var manager = new MediaControllerManager())
+ {
+ var controller = manager.GetActiveControllers().Single(
+ c => c.ServerAppId == Application.Current.ApplicationInfo.ApplicationId);
+
+ var capabilities = new Dictionary<MediaControlPlaybackCommand, MediaControlCapabilitySupport>()
+ {
+ {MediaControlPlaybackCommand.FastForward, MediaControlCapabilitySupport.Supported },
+ {MediaControlPlaybackCommand.Next, MediaControlCapabilitySupport.Supported },
+ {MediaControlPlaybackCommand.Pause, MediaControlCapabilitySupport.Supported },
+ {MediaControlPlaybackCommand.Play, MediaControlCapabilitySupport.Supported },
+ {MediaControlPlaybackCommand.Previous, MediaControlCapabilitySupport.Supported },
+ {MediaControlPlaybackCommand.Rewind, MediaControlCapabilitySupport.Supported },
+ {MediaControlPlaybackCommand.Stop, MediaControlCapabilitySupport.Supported },
+ {MediaControlPlaybackCommand.Toggle, MediaControlCapabilitySupport.Supported }
+ };
+
+ Assert.That(() => MediaControlServer.SetPlaybackCapabilities(capabilities), Throws.Nothing);
+
+ Assert.That(controller.GetPlaybackCapabilities(), Is.EqualTo(capabilities));
+ }
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether SetPlaybackCapabilities throws exception if parameter is invalid")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.SetPlaybackCapabilities M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void SetPlaybackCapabilities_THROWS_EXCEPTION()
+ {
+ var capabilities = new Dictionary<MediaControlPlaybackCommand, MediaControlCapabilitySupport>()
+ { {MediaControlPlaybackCommand.Play - 1, MediaControlCapabilitySupport.Supported } };
+ Assert.Throws<ArgumentException>(() => MediaControlServer.SetPlaybackCapabilities(capabilities));
+
+ capabilities = new Dictionary<MediaControlPlaybackCommand, MediaControlCapabilitySupport>()
+ { {MediaControlPlaybackCommand.Toggle + 1, MediaControlCapabilitySupport.Supported } };
+ Assert.Throws<ArgumentException>(() => MediaControlServer.SetPlaybackCapabilities(capabilities));
+
+ capabilities = new Dictionary<MediaControlPlaybackCommand, MediaControlCapabilitySupport>()
+ { {MediaControlPlaybackCommand.Play, MediaControlCapabilitySupport.NotDecided } };
+ Assert.Throws<ArgumentException>(() => MediaControlServer.SetPlaybackCapabilities(capabilities));
+
+ capabilities = new Dictionary<MediaControlPlaybackCommand, MediaControlCapabilitySupport>()
+ { {MediaControlPlaybackCommand.Play, MediaControlCapabilitySupport.Supported - 1 } };
+ Assert.Throws<ArgumentException>(() => MediaControlServer.SetPlaybackCapabilities(capabilities));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Sets content type of current playing media")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.SetPlaybackContentType M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void SetPlaybackContentType_THROWS_NOTHING()
+ {
+ using (var manager = new MediaControllerManager())
+ {
+ var controller = manager.GetActiveControllers().Single(
+ c => c.ServerAppId == Application.Current.ApplicationInfo.ApplicationId);
+
+ var contentType = MediaControlContentType.Music;
+ MediaControlServer.SetPlaybackContentType(contentType);
+
+ Assert.That(controller.GetContentTypeOfCurrentPlayingMedia(), Is.EqualTo(contentType));
+ }
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether SetPlaybackContentType throws exception if parameter is invalid")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.SetPlaybackContentType M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void SetPlaybackContentType_THROWS_EXCEPTION()
+ {
+ Assert.Throws<ArgumentException>(() => MediaControlServer.SetPlaybackContentType(MediaControlContentType.Image - 1));
+
+ Assert.Throws<ArgumentException>(() => MediaControlServer.SetPlaybackContentType(MediaControlContentType.NotDecided));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Sets repeat mode capability")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.SetRepeatModeCapability M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void SetRepeatModeCapability_RETURN_VALUE()
+ {
+ using (var manager = new MediaControllerManager())
+ {
+ var controller = manager.GetActiveControllers().Single(
+ c => c.ServerAppId == Application.Current.ApplicationInfo.ApplicationId);
+
+ MediaControlServer.SetRepeatModeCapability(MediaControlCapabilitySupport.NotSupported);
+ Assert.That(controller.GetRepeatModeCapability(), Is.EqualTo(MediaControlCapabilitySupport.NotSupported));
+
+ MediaControlServer.SetRepeatModeCapability(MediaControlCapabilitySupport.Supported);
+ Assert.That(controller.GetRepeatModeCapability(), Is.EqualTo(MediaControlCapabilitySupport.Supported));
+ }
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether SetRepeatModeCapability throws exception if parameter is invalid")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.SetRepeatModeCapability M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void SetRepeatModeCapability_THROWS_EXCEPTION()
+ {
+ Assert.Throws<ArgumentException>(() =>
+ MediaControlServer.SetRepeatModeCapability(MediaControlCapabilitySupport.Supported - 1));
+
+ Assert.Throws<ArgumentException>(() =>
+ MediaControlServer.SetRepeatModeCapability(MediaControlCapabilitySupport.NotDecided));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Sets shuffle mode capability")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.SetShuffleModeCapability M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void SetShuffleModeCapability_RETURN_VALUE()
+ {
+ using (var manager = new MediaControllerManager())
+ {
+ var controller = manager.GetActiveControllers().Single(
+ c => c.ServerAppId == Application.Current.ApplicationInfo.ApplicationId);
+
+ MediaControlServer.SetShuffleModeCapability(MediaControlCapabilitySupport.NotSupported);
+ Assert.That(controller.GetShuffleModeCapability(), Is.EqualTo(MediaControlCapabilitySupport.NotSupported));
+
+ MediaControlServer.SetShuffleModeCapability(MediaControlCapabilitySupport.Supported);
+ Assert.That(controller.GetShuffleModeCapability(), Is.EqualTo(MediaControlCapabilitySupport.Supported));
+ }
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether SetShuffleModeCapability throws exception if parameter is invalid")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.SetShuffleModeCapability M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void SetShuffleModeCapability_THROW_EXCEPTION()
+ {
+ Assert.Throws<ArgumentException>(() =>
+ MediaControlServer.SetShuffleModeCapability(MediaControlCapabilitySupport.Supported - 1));
+
+ Assert.Throws<ArgumentException>(() =>
+ MediaControlServer.SetShuffleModeCapability(MediaControlCapabilitySupport.NotDecided));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Invoked when server sends custom command")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.CustomCommandReceived E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public async Task CustomCommandReceived_CHECK_EVENT()
+ {
+ using (var eventWaiter = EventAwaiter<CustomCommandReceivedEventArgs>.Create())
+ using (var manager = new MediaControllerManager())
+ {
+ var controller = manager.GetActiveControllers().Single(
+ c => c.ServerAppId == Application.Current.ApplicationInfo.ApplicationId);
+
+ try
+ {
+ MediaControlServer.CustomCommandReceived += eventWaiter;
+
+ await Task.Run(() =>
+ {
+ controller.RequestAsync(new CustomCommand("CustomCommand"));
+ });
+
+ Assert.That(await eventWaiter.IsRaisedAsync());
+ }
+ finally
+ {
+ MediaControlServer.CustomCommandReceived -= eventWaiter;
+ }
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Invoked when server sends playback command")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.PlaybackActionCommandReceived E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public async Task PlaybackActionCommandReceived_CHECK_EVENT()
+ {
+ using (var eventWaiter = EventAwaiter<PlaybackActionCommandReceivedEventArgs>.Create())
+ using (var manager = new MediaControllerManager())
+ {
+ var controller = manager.GetActiveControllers().Single(
+ c => c.ServerAppId == Application.Current.ApplicationInfo.ApplicationId);
+
+ MediaControlServer.PlaybackActionCommandReceived += eventWaiter;
+
+ await Task.Run(() =>
+ {
+ controller.RequestAsync(new PlaybackCommand(MediaControlPlaybackCommand.Play));
+ });
+
+ Assert.That(await eventWaiter.IsRaisedAsync());
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Invoked when server sends playback position command")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.PlaybackPositionCommandReceived E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public async Task PlaybackPositionCommandReceived_CHECK_EVENT()
+ {
+ using (var eventWaiter = EventAwaiter<PlaybackPositionCommandReceivedEventArgs>.Create())
+ using (var manager = new MediaControllerManager())
+ {
+ var controller = manager.GetActiveControllers().Single(
+ c => c.ServerAppId == Application.Current.ApplicationInfo.ApplicationId);
+
+ MediaControlServer.PlaybackPositionCommandReceived += eventWaiter;
+
+ await Task.Run(() =>
+ {
+ controller.RequestAsync(new PlaybackPositionCommand(100));
+ });
+
+ Assert.That(await eventWaiter.IsRaisedAsync());
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Invoked when server sends playlist command")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.PlaylistCommandReceived E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public async Task PlaylistCommandReceived_CHECK_EVENT()
+ {
+ using (var eventWaiter = EventAwaiter<PlaylistCommandReceivedEventArgs>.Create())
+ using (var manager = new MediaControllerManager())
+ {
+ var controller = manager.GetActiveControllers().Single(
+ c => c.ServerAppId == Application.Current.ApplicationInfo.ApplicationId);
+
+ MediaControlServer.PlaylistCommandReceived += eventWaiter;
+
+ await Task.Run(() =>
+ {
+ controller.RequestAsync(new PlaylistCommand(MediaControlPlaybackCommand.Play,
+ "MyFavor", "Song1", 100));
+ });
+
+ Assert.That(await eventWaiter.IsRaisedAsync());
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Invoked when server sends repeat mode command")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.RepeatModeCommandReceived E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public async Task RepeatModeCommandReceived_CHECK_EVENT()
+ {
+ using (var eventWaiter = EventAwaiter<RepeatModeCommandReceivedEventArgs>.Create())
+ using (var manager = new MediaControllerManager())
+ {
+ var controller = manager.GetActiveControllers().Single(
+ c => c.ServerAppId == Application.Current.ApplicationInfo.ApplicationId);
+
+ MediaControlServer.RepeatModeCommandReceived += eventWaiter;
+
+ await Task.Run(() =>
+ {
+ controller.RequestAsync(new RepeatModeCommand(MediaControlRepeatMode.On));
+ });
+
+ Assert.That(await eventWaiter.IsRaisedAsync());
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Invoked when server sends shuffle mode command")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.ShuffleModeCommandReceived E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public async Task ShuffleModeCommandReceived_CHECK_EVENT()
+ {
+ using (var eventWaiter = EventAwaiter<ShuffleModeCommandReceivedEventArgs>.Create())
+ using (var manager = new MediaControllerManager())
+ {
+ var controller = manager.GetActiveControllers().Single(
+ c => c.ServerAppId == Application.Current.ApplicationInfo.ApplicationId);
+
+ MediaControlServer.ShuffleModeCommandReceived += eventWaiter;
+
+ await Task.Run(() =>
+ {
+ controller.RequestAsync(new ShuffleModeCommand(true));
+ });
+
+ Assert.That(await eventWaiter.IsRaisedAsync());
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Invoked when server sends search command")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.SearchCommandReceived E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public async Task SearchCommandReceived_CHECK_EVENT()
+ {
+ using (var eventWaiter = EventAwaiter<SearchCommandReceivedEventArgs>.Create())
+ using (var manager = new MediaControllerManager())
+ {
+ var controller = manager.GetActiveControllers().Single(
+ c => c.ServerAppId == Application.Current.ApplicationInfo.ApplicationId);
+
+ MediaControlServer.SearchCommandReceived += eventWaiter;
+
+ await Task.Run(() =>
+ {
+ controller.RequestAsync(new SearchCommand(
+ new MediaControlSearchCondition(MediaControlContentType.Music, "Song1", null))
+ );
+ });
+
+ Assert.That(await eventWaiter.IsRaisedAsync());
+ }
+ }
}
}
using NUnit.Framework;
+using System;
using System.Linq;
using System.Threading.Tasks;
+using System.Collections.Generic;
using Tizen.Applications;
+using Tizen.Internals.Errors;
namespace Tizen.Multimedia.Remoting.Tests
{
{
private MediaController _controller;
private MediaControllerManager _manager;
+ private CustomCommand _command;
[SetUp]
public void SetUp()
_manager = new MediaControllerManager();
_controller = _manager.GetActiveControllers().Single(
c => c.ServerAppId == Application.Current.ApplicationInfo.ApplicationId);
+ _command = new CustomCommand("Custom");
}
[TearDown]
Assert.That(() => _controller.SendPlaybackCommand((MediaControlPlaybackCommand)(-1)),
Throws.ArgumentException);
}
+
+ [Test]
+ [Category("P1")]
+ [Description("Returns age rating value of current playing media")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaController.GetAgeRatingOfCurrentPlayingMedia M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void GetAgeRatingOfCurrentPlayingMedia_RETURN_VALUE()
+ {
+ var ageRating = 12;
+ MediaControlServer.SetAgeRating(ageRating);
+
+ Assert.That(_controller.GetAgeRatingOfCurrentPlayingMedia(), Is.EqualTo(ageRating));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Returns content type of current playing media")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaController.GetContentTypeOfCurrentPlayingMedia M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void GetContentTypeOfCurrentPlayingMedia_RETURN_VALUE()
+ {
+ var contentType = MediaControlContentType.Music;
+ MediaControlServer.SetPlaybackContentType(contentType);
+
+ Assert.That(_controller.GetContentTypeOfCurrentPlayingMedia(), Is.EqualTo(contentType));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Sets icon path. And get and compare it with the value previously set")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaController.GetIconPath M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void GetIconPath_RETURN_VALUE()
+ {
+ var iconPath = "test.jpg";
+ MediaControlServer.SetIconPath(iconPath);
+
+ Assert.That(_controller.GetIconPath(), Is.EqualTo(iconPath));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Returns index of current playing media")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaController.GetIndexOfCurrentPlayingMedia M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void GetIndexOfCurrentPlayingMedia_RETURN_VALUE()
+ {
+ var index = "ID1";
+ MediaControlServer.SetIndexOfCurrentPlayingMedia(index);
+
+ Assert.That(_controller.GetIndexOfCurrentPlayingMedia(), Is.EqualTo(index));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Sets playback capability and compare it with the value previosly set")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaController.GetPlaybackCapability M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void GetPlaybackCapability_RETURN_VALUE()
+ {
+ foreach (MediaControlPlaybackCommand capability in Enum.GetValues(typeof(MediaControlPlaybackCommand)))
+ {
+ // NotDecided can not be set directly.
+
+ var isSupported = MediaControlCapabilitySupport.NotSupported;
+ MediaControlServer.SetPlaybackCapability(capability, isSupported);
+ Assert.That(_controller.GetPlaybackCapability(capability), Is.EqualTo(isSupported));
+
+ isSupported = MediaControlCapabilitySupport.Supported;
+ MediaControlServer.SetPlaybackCapability(capability, isSupported);
+ Assert.That(_controller.GetPlaybackCapability(capability), Is.EqualTo(isSupported));
+ }
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Sets playback capability and compare it with the value previosly set")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaController.GetPlaybackCapability M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void GetPlaybackCapability_THROWS_EXCEPTION()
+ {
+ foreach (MediaControlPlaybackCommand capability in Enum.GetValues(typeof(MediaControlPlaybackCommand)))
+ {
+ // NotDecided can not be set directly.
+
+ var isSupported = MediaControlCapabilitySupport.NotSupported;
+ MediaControlServer.SetPlaybackCapability(capability, isSupported);
+ Assert.That(_controller.GetPlaybackCapability(capability), Is.EqualTo(isSupported));
+
+ isSupported = MediaControlCapabilitySupport.Supported;
+ MediaControlServer.SetPlaybackCapability(capability, isSupported);
+ Assert.That(_controller.GetPlaybackCapability(capability), Is.EqualTo(isSupported));
+
+ Assert.Throws<ArgumentException>(() => _controller.GetPlaybackCapability(MediaControlPlaybackCommand.Play - 1));
+ Assert.Throws<ArgumentException>(() => _controller.GetPlaybackCapability(MediaControlPlaybackCommand.Toggle + 1));
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Sets playback capabilities and compare it with the value previosly set")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaController.GetPlaybackCapabilities M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void GetPlaybackCapabilities_RETURN_VALUE()
+ {
+ var capabilities = new Dictionary<MediaControlPlaybackCommand, MediaControlCapabilitySupport>()
+ {
+ {MediaControlPlaybackCommand.FastForward, MediaControlCapabilitySupport.Supported },
+ {MediaControlPlaybackCommand.Next, MediaControlCapabilitySupport.Supported },
+ {MediaControlPlaybackCommand.Pause, MediaControlCapabilitySupport.Supported },
+ {MediaControlPlaybackCommand.Play, MediaControlCapabilitySupport.Supported },
+ {MediaControlPlaybackCommand.Previous, MediaControlCapabilitySupport.Supported },
+ {MediaControlPlaybackCommand.Rewind, MediaControlCapabilitySupport.Supported },
+ {MediaControlPlaybackCommand.Stop, MediaControlCapabilitySupport.Supported },
+ {MediaControlPlaybackCommand.Toggle, MediaControlCapabilitySupport.Supported }
+ };
+
+ MediaControlServer.SetPlaybackCapabilities(capabilities);
+
+ Assert.That(_controller.GetPlaybackCapabilities(), Is.EqualTo(capabilities));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Returns playlist of currnet playing media")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaController.GetPlaylistOfCurrentPlayingMedia M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void GetPlaylistOfCurrentPlayingMedia_RETURN_VALUE()
+ {
+ using (var playlist1 = new MediaControlPlaylist("MyFavor",
+ new Dictionary<string, MediaControlMetadata>() { { "Song1", new MediaControlMetadata() } }))
+ using (var playlist2 = new MediaControlPlaylist("Classic",
+ new Dictionary<string, MediaControlMetadata>() { { "Song2", new MediaControlMetadata() } }))
+ {
+ var playlistName = "Classic";
+ var index = "Song2";
+ MediaControlServer.SetInfoOfCurrentPlayingMedia(playlistName, index);
+
+ Assert.That(_controller.GetPlaylistOfCurrentPlayingMedia().Name, Is.EqualTo(playlistName));
+ };
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Returns all playlists created before")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaController.GetPlaylists M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void GetPlaylists_RETURN_VALUE()
+ {
+ using (var playlist1 = new MediaControlPlaylist("MyFavor",
+ new Dictionary<string, MediaControlMetadata>() { { "Song1", new MediaControlMetadata() } }))
+ using (var playlist2 = new MediaControlPlaylist("Classic",
+ new Dictionary<string, MediaControlMetadata>() { { "Song2", new MediaControlMetadata() } }))
+ {
+ foreach (var playlist in _controller.GetPlaylists())
+ {
+ Assert.IsTrue(playlist.Name.Equals(playlist1.Name) || playlist.Name.Equals(playlist2.Name));
+ }
+ };
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Sets repeat mode capability and compare it with the value previosly set")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaController.GetRepeatModeCapability M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void GetRepeatModeCapability_RETURN_VALUE()
+ {
+ MediaControlServer.SetRepeatModeCapability(MediaControlCapabilitySupport.NotSupported);
+ Assert.That(_controller.GetRepeatModeCapability(), Is.EqualTo(MediaControlCapabilitySupport.NotSupported));
+
+ MediaControlServer.SetRepeatModeCapability(MediaControlCapabilitySupport.Supported);
+ Assert.That(_controller.GetRepeatModeCapability(), Is.EqualTo(MediaControlCapabilitySupport.Supported));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Sets shuffle mode capability and compare it with the value previosly set")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaController.GetShuffleModeCapability M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void GetShuffleModeCapability_RETURN_VALUE()
+ {
+ MediaControlServer.SetShuffleModeCapability(MediaControlCapabilitySupport.NotSupported);
+ Assert.That(_controller.GetShuffleModeCapability(), Is.EqualTo(MediaControlCapabilitySupport.NotSupported));
+
+ MediaControlServer.SetShuffleModeCapability(MediaControlCapabilitySupport.Supported);
+ Assert.That(_controller.GetShuffleModeCapability(), Is.EqualTo(MediaControlCapabilitySupport.Supported));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Throws nothing when request to server")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaController.RequestAsync M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public async Task RequestAsync_THROWS_NOTHING()
+ {
+ CustomCommand customCommand = null;
+ EventHandler<CustomCommandReceivedEventArgs> eventHandler = (s, e) =>
+ {
+ customCommand = e.Command;
+ Log.Info("Remoting.Tests", $"e.Command.Action : {e.Command.Action}");
+
+ MediaControlServer.Response(customCommand, (int)ErrorCode.None, new Bundle());
+ };
+
+ try
+ {
+ MediaControlServer.CustomCommandReceived += eventHandler;
+
+ await Task.Run(() =>
+ {
+ Assert.That(() => _controller.RequestAsync(_command), Throws.Nothing);
+ });
+ }
+ finally
+ {
+ MediaControlServer.CustomCommandReceived -= eventHandler;
+ }
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether RequestAsync throws exception if server response with error")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaController.RequestAsync M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public async Task RequestAsync_THROWS_EXCEPTION()
+ {
+ CustomCommand customCommand = null;
+
+ EventHandler<CustomCommandReceivedEventArgs> eventHandler = (s, e) =>
+ {
+ customCommand = e.Command;
+ Log.Info("Remoting.Tests", $"22 e.Command.Action : {e.Command.Action}");
+
+ MediaControlServer.Response(customCommand, (int)ErrorCode.InvalidOperation, new Bundle());
+ };
+
+ try
+ {
+ MediaControlServer.CustomCommandReceived += eventHandler;
+
+ await Task.Run(() =>
+ {
+ Assert.That(() => _controller.RequestAsync(_command), Throws.InvalidOperationException);
+ });
+ }
+ finally
+ {
+ MediaControlServer.CustomCommandReceived -= eventHandler;
+ }
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether RequestAsync throws exception if parameter is null")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaController.RequestAsync M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void RequestAsync_THROWS_EXCEPTION_NULL()
+ {
+ Assert.That(() => _controller.RequestAsync(null), Throws.ArgumentNullException);
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Throws nothing when response to server")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaController.Response M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("COVPARAM", "Command, int")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public async Task Response_THROWS_NOTHING()
+ {
+ CustomCommand customCommand = null;
+
+ _controller.CustomCommandReceived += (s, e) =>
+ {
+ customCommand = e.Command;
+
+ Assert.That(() => _controller.Response(customCommand, 0), Throws.Nothing);
+ };
+
+ await Task.Run(() =>
+ {
+ MediaControlServer.RequestAsync(new CustomCommand("CustomCommand"),
+ Application.Current.ApplicationInfo.ApplicationId);
+ });
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether Response throws exception if server is not working")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaController.Response M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "Command, int")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Response_THROWS_EXCEPTION()
+ {
+ MediaControlServer.Stop();
+
+ Assert.That(() => _controller.Response(new CustomCommand("Custom"), 0), Throws.InvalidOperationException);
+ Assert.That(() => _controller.Response(null, 0), Throws.ArgumentNullException);
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Throws nothing when response to server")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaController.Response M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("COVPARAM", "Command, int, Bundle")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public async Task Response_WITH_BUNDLE_THROWS_NOTHING()
+ {
+ CustomCommand customCommand = null;
+
+ _controller.CustomCommandReceived += (s, e) =>
+ {
+ customCommand = e.Command;
+
+ Assert.That(() => _controller.Response(customCommand, 0, new Bundle()), Throws.Nothing);
+ };
+
+ await Task.Run(() =>
+ {
+ MediaControlServer.RequestAsync(new CustomCommand("CustomCommand"),
+ Application.Current.ApplicationInfo.ApplicationId);
+ });
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether Response throws exception if server is not working")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaController.Response M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "Command, int, Bundle")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Response_WITH_BUNDLE_THROWS_EXCEPTION()
+ {
+ MediaControlServer.Stop();
+
+ Assert.That(() => _controller.Response(new CustomCommand("Custom"), 0, new Bundle()), Throws.InvalidOperationException);
+ Assert.That(() => _controller.Response(null, 0, new Bundle()), Throws.ArgumentNullException);
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Invoked when server sends custom command")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaController.CustomCommandReceived E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public async Task CustomCommandReceived_CHECK_EVENT()
+ {
+ using (var eventWaiter = EventAwaiter<CustomCommandReceivedEventArgs>.Create())
+ {
+ _controller.CustomCommandReceived += eventWaiter;
+
+ await Task.Run(() =>
+ {
+ MediaControlServer.RequestAsync(new CustomCommand("CustomCommand"),
+ Application.Current.ApplicationInfo.ApplicationId);
+ });
+
+ Assert.That(await eventWaiter.IsRaisedAsync());
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Invoked when the server set playback capability")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaController.PlaybackCapabilityUpdated E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public async Task PlaybackCapabilityUpdated_CHECK_EVENT()
+ {
+ using (var eventWaiter = EventAwaiter<PlaybackCapabilityUpdatedEventArgs>.Create())
+ {
+ _controller.PlaybackCapabilityUpdated += eventWaiter;
+
+ MediaControlServer.SetPlaybackCapability(MediaControlPlaybackCommand.Play,
+ MediaControlCapabilitySupport.NotSupported);
+
+ Assert.That(await eventWaiter.IsRaisedAsync());
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Invoked when the playlist is created")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaController.PlaylistUpdated E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public async Task PlaylistUpdated_CHECK_EVENT()
+ {
+ using (var eventWaiter = EventAwaiter<PlaylistUpdatedEventArgs>.Create())
+ {
+ _controller.PlaylistUpdated += eventWaiter;
+
+ new MediaControlPlaylist("MyFavor");
+
+ Assert.That(await eventWaiter.IsRaisedAsync());
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Invoked when the server set repeat mode capability")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaController.RepeatModeCapabilityUpdated E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public async Task RepeatModeCapabilityUpdated_CHECK_EVENT()
+ {
+ using (var eventWaiter = EventAwaiter<RepeatModeCapabilityUpdatedEventArgs>.Create())
+ {
+ _controller.RepeatModeCapabilityUpdated += eventWaiter;
+
+ MediaControlServer.SetRepeatModeCapability(MediaControlCapabilitySupport.NotSupported);
+
+ var args = await eventWaiter.GetResultAsync();
+ Assert.IsTrue(args.Support.Equals(MediaControlCapabilitySupport.NotSupported));
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Invoked when the server set shuffle mode capability")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaController.ShuffleModeCapabilityUpdated E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public async Task ShuffleModeCapabilityUpdated_CHECK_EVENT()
+ {
+ using (var eventWaiter = EventAwaiter<ShuffleModeCapabilityUpdatedEventArgs>.Create())
+ {
+ _controller.ShuffleModeCapabilityUpdated += eventWaiter;
+
+ MediaControlServer.SetShuffleModeCapability(MediaControlCapabilitySupport.NotSupported);
+
+ var args = await eventWaiter.GetResultAsync();
+ Assert.IsTrue(args.Support.Equals(MediaControlCapabilitySupport.NotSupported));
+ }
+ }
}
-}
\ No newline at end of file
+}
--- /dev/null
+using NUnit.Framework;
+using System;
+
+namespace Tizen.Multimedia.Remoting.Tests
+{
+ [TestFixture]
+ [Description("Testing Tizen.Multimedia.Remoting.PlaybackActionCommandReceivedEventArgs class")]
+ public class PlaybackActionCommandReceivedEventArgsTests
+ {
+ [Test]
+ [Category("P1")]
+ [Description("Create PlaybackActionCommandReceivedEventArgs instance")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.PlaybackActionCommandReceivedEventArgs.PlaybackActionCommandReceivedEventArgs C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void PlaybackActionCommandReceivedEventArgs_CONSTRUCTOR()
+ {
+ Assert.That(() => new PlaybackActionCommandReceivedEventArgs(
+ new PlaybackCommand(MediaControlPlaybackCommand.Play)), Throws.Nothing);
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether PlaybackActionCommandReceivedEventArgs throws exception if parameter is invalid")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.PlaybackActionCommandReceivedEventArgs.PlaybackActionCommandReceivedEventArgs C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTN")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void PlaybackActionCommandReceivedEventArgs_THROWS_EXCEPTION()
+ {
+ Assert.Throws<ArgumentNullException>(() => new PlaybackActionCommandReceivedEventArgs(null));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check whether Command property is instance of PlaybackCommand or not.")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.PlaybackActionCommandReceivedEventArgs.Command A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Command_READ_ONLY()
+ {
+ var args = new PlaybackActionCommandReceivedEventArgs(new PlaybackCommand(MediaControlPlaybackCommand.Play));
+
+ Assert.IsInstanceOf<PlaybackCommand>(args.Command);
+ Assert.That(() => args.Command.Action, Is.EqualTo(MediaControlPlaybackCommand.Play));
+ }
+ }
+}
using NUnit.Framework;
+using System;
using System.Collections.Generic;
namespace Tizen.Multimedia.Remoting.Tests
[Test]
[Category("P1")]
- [Description("Constructor")]
+ [Description("Create PlaybackCapabilityUpdatedEventArgs instance")]
[Property("SPEC", "Tizen.Multimedia.Remoting.PlaybackCapabilityUpdatedEventArgs.PlaybackCapabilityUpdatedEventArgs C")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "CONSTR")]
}
[Test]
+ [Category("P2")]
+ [Description("Check whether PlaybackCapabilityUpdatedEventArgs throws exception if parameter is invalid")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.PlaybackCapabilityUpdatedEventArgs.PlaybackCapabilityUpdatedEventArgs C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTN")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void PlaybackCapabilityUpdatedEventArgs_THROWS_EXCEPTION()
+ {
+ Assert.Throws<ArgumentNullException>(() => new PlaybackCapabilityUpdatedEventArgs(null));
+ }
+
+ [Test]
[Category("P1")]
[Description("Is always not null")]
[Property("SPEC", "Tizen.Multimedia.Remoting.PlaybackCapabilityUpdatedEventArgs.Support A")]
[Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
public void Support_READ_ONLY()
{
- Assert.That(() => new PlaybackActionCommandReceivedEventArgs(
- new PlaybackCommand(MediaControlPlaybackCommand.Play)).Command, Is.Not.Null);
+ var args = new PlaybackCapabilityUpdatedEventArgs(
+ new Dictionary<MediaControlPlaybackCommand, MediaControlCapabilitySupport>()
+ {
+ {MediaControlPlaybackCommand.Play, MediaControlCapabilitySupport.Supported}
+ });
+
+ Assert.IsInstanceOf<Dictionary<MediaControlPlaybackCommand, MediaControlCapabilitySupport>>(args.Support);
+
+ args.Support.TryGetValue(MediaControlPlaybackCommand.Play, out MediaControlCapabilitySupport isSupported);
+ Assert.That(() => isSupported, Is.EqualTo(MediaControlCapabilitySupport.Supported));
}
}
}
--- /dev/null
+using NUnit.Framework;
+using System;
+using System.Linq;
+using System.Threading.Tasks;
+using Tizen.Applications;
+
+namespace Tizen.Multimedia.Remoting.Tests
+{
+ [TestFixture]
+ [Description("Testing Tizen.Multimedia.Remoting.PlaybackCommand class")]
+ public class PlaybackCommandTests
+ {
+ private MediaController _controller;
+ private MediaControllerManager _manager;
+ private PlaybackCommand _command;
+
+ [SetUp]
+ public void SetUp()
+ {
+ MediaControlServer.Start();
+
+ _manager = new MediaControllerManager();
+ _controller = _manager.GetActiveControllers().Single(
+ c => c.ServerAppId == Application.Current.ApplicationInfo.ApplicationId);
+ _command = new PlaybackCommand(MediaControlPlaybackCommand.Play);
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ if (MediaControlServer.IsRunning)
+ {
+ MediaControlServer.Stop();
+ }
+
+ _manager.Dispose();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Create PlaybackCommand instance")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.PlaybackCommand.PlaybackCommand C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void PlaybackCommand_CHECK_CREATE_CONSTRUCTOR()
+ {
+ Assert.IsNotNull(_command, "Object should not be null after initializing");
+ Assert.IsInstanceOf<PlaybackCommand>(_command, "Should return PlaybackCommand instance");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether PlaybackCommand throws exception if parameter is invalid")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.PlaybackCommand.PlaybackCommand C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTN")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void PlaybackCommand_THROWS_EXCEPTION()
+ {
+ Assert.Throws<ArgumentException>(() => new PlaybackCommand(MediaControlPlaybackCommand.Play - 1));
+ Assert.Throws<ArgumentException>(() => new PlaybackCommand(MediaControlPlaybackCommand.Toggle + 1));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check whether Action property is type of MediaControlPlaybackCommand or not.")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.PlaybackCommand.Action A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Action_READ_ONLY()
+ {
+ Assert.That(_command.Action, Is.TypeOf<MediaControlPlaybackCommand>());
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using NUnit.Framework;
+using System.Linq;
+using Tizen.Applications;
+
+namespace Tizen.Multimedia.Remoting.Tests
+{
+ [TestFixture]
+ [Description("Testing Tizen.Multimedia.Remoting.PlaybackPositionCommand class")]
+ public class PlaybackPositionCommandTests
+ {
+ private MediaController _controller;
+ private MediaControllerManager _manager;
+ private PlaybackPositionCommand _command;
+ private ulong _position = 10U;
+
+ [SetUp]
+ public void SetUp()
+ {
+ MediaControlServer.Start();
+
+ _manager = new MediaControllerManager();
+ _controller = _manager.GetActiveControllers().Single(
+ c => c.ServerAppId == Application.Current.ApplicationInfo.ApplicationId);
+ _command = new PlaybackPositionCommand(_position);
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ if (MediaControlServer.IsRunning)
+ {
+ MediaControlServer.Stop();
+ }
+
+ _manager.Dispose();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Create PlaybackPositionCommand instance")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.PlaybackPositionCommand.PlaybackPositionCommand C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void PlaybackPositionCommand_CHECK_CREATE_CONSTRUCTOR()
+ {
+ Assert.IsNotNull(_command, "Object should not be null after initializing");
+ Assert.IsInstanceOf<PlaybackPositionCommand>(_command, "Should return PlaybackPositionCommand instance");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check whether Position property is type of ulong or not.")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.PlaybackPositionCommand.Position A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Position_READ_ONLY()
+ {
+ Assert.IsInstanceOf<ulong>(_command.Position);
+ Assert.That(() => _command.Position, Is.EqualTo(_position));
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using NUnit.Framework;
+using System;
+
+namespace Tizen.Multimedia.Remoting.Tests
+{
+ [TestFixture]
+ [Description("Testing Tizen.Multimedia.Remoting.PlaybackPositionCommandReceivedEventArgs class")]
+ public class PlaybackPositionCommandReceivedEventArgsTests
+ {
+ [Test]
+ [Category("P1")]
+ [Description("Create PlaybackPositionCommandReceivedEventArgs instance")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.PlaybackPositionCommandReceivedEventArgs.PlaybackPositionCommandReceivedEventArgs C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void PlaybackPositionCommandReceivedEventArgs_CONSTRUCTOR()
+ {
+ Assert.That(() => new PlaybackPositionCommandReceivedEventArgs(new PlaybackPositionCommand(10)), Throws.Nothing);
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether PlaybackPositionCommandReceivedEventArgs throws exception if parameter is invalid")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.PlaybackPositionCommandReceivedEventArgs.PlaybackPositionCommandReceivedEventArgs C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTN")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void PlaybackPositionCommandReceivedEventArgs_THROWS_EXCEPTION()
+ {
+ Assert.Throws<ArgumentNullException>(() => new PlaybackPositionCommandReceivedEventArgs(null));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check whether Command property is instance of PlaybackPositionCommand or not.")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.PlaybackPositionCommandReceivedEventArgs.Command A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Command_READ_ONLY()
+ {
+ var position = 10U;
+ var args = new PlaybackPositionCommandReceivedEventArgs(new PlaybackPositionCommand(position));
+
+ Assert.IsInstanceOf<ulong>(args.Command.Position);
+ Assert.That(() => args.Command.Position, Is.EqualTo(position));
+ }
+ }
+}
--- /dev/null
+using NUnit.Framework;
+using System;
+using System.Linq;
+using System.Threading.Tasks;
+using Tizen.Applications;
+
+namespace Tizen.Multimedia.Remoting.Tests
+{
+ [TestFixture]
+ [Description("Testing Tizen.Multimedia.Remoting.PlaylistCommand class")]
+ public class PlaylistCommandTests
+ {
+ private MediaController _controller;
+ private MediaControllerManager _manager;
+ private PlaylistCommand _command;
+ private MediaControlPlaybackCommand _action = MediaControlPlaybackCommand.Play;
+ private string _playlistName = "MyFavor";
+ private string _index = "ID1";
+ private ulong _position = 10U;
+
+ [SetUp]
+ public void SetUp()
+ {
+ MediaControlServer.Start();
+
+ _manager = new MediaControllerManager();
+ _controller = _manager.GetActiveControllers().Single(
+ c => c.ServerAppId == Application.Current.ApplicationInfo.ApplicationId);
+ _command = new PlaylistCommand(_action, _playlistName, _index, _position);
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ if (MediaControlServer.IsRunning)
+ {
+ MediaControlServer.Stop();
+ }
+
+ _manager.Dispose();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Create PlaylistCommand instance")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.PlaylistCommand.PlaylistCommand C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("COVPARAM", "MediaControlPlaybackCommand, string, string, UInt64")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void PlaylistCommand_CHECK_CREATE_CONSTRUCTOR()
+ {
+ Assert.IsNotNull(_command, "Object should not be null after initializing");
+ Assert.IsInstanceOf<PlaylistCommand>(_command, "Should return PlaylistCommand instance");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Create PlaylistCommand instance")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.PlaylistCommand.PlaylistCommand C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("COVPARAM", "MediaControlPlaybackCommand, string, string")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void PlaylistCommand_CHECK_CREATE_CONSTRUCTOR_WITHOUT_POSITION()
+ {
+ var command = new PlaylistCommand(MediaControlPlaybackCommand.Play, "test", "1");
+ Assert.IsNotNull(command, "Object should not be null after initializing");
+ Assert.IsInstanceOf<PlaylistCommand>(command, "Should return PlaylistCommand instance");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether PlaylistCommand throws exception if parameter is invalid")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.PlaylistCommand.PlaylistCommand C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTN")]
+ [Property("COVPARAM", "MediaControlPlaybackCommand, string, string, UInt64")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void PlaylistCommand_THROWS_EXCEPTION()
+ {
+ Assert.Throws<ArgumentException>(() => new PlaylistCommand(MediaControlPlaybackCommand.Play - 1, "test", "1", 10));
+ Assert.Throws<ArgumentException>(() => new PlaylistCommand(MediaControlPlaybackCommand.Toggle + 1, "test", "1", 10));
+ Assert.Throws<ArgumentNullException>(() => new PlaylistCommand(MediaControlPlaybackCommand.Play, null, "1", 10));
+ Assert.Throws<ArgumentNullException>(() => new PlaylistCommand(MediaControlPlaybackCommand.Play, "test", null, 10));
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether PlaylistCommand throws exception if parameter is invalid")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.PlaylistCommand.PlaylistCommand C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTN")]
+ [Property("COVPARAM", "MediaControlPlaybackCommand, string, string")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void PlaylistCommand_WITHOUT_POSITION_THROWS_EXCEPTION()
+ {
+ Assert.Throws<ArgumentException>(() => new PlaylistCommand(MediaControlPlaybackCommand.Play - 1, "test", "1"));
+ Assert.Throws<ArgumentException>(() => new PlaylistCommand(MediaControlPlaybackCommand.Toggle + 1, "test", "1"));
+ Assert.Throws<ArgumentNullException>(() => new PlaylistCommand(MediaControlPlaybackCommand.Play, null, "1"));
+ Assert.Throws<ArgumentNullException>(() => new PlaylistCommand(MediaControlPlaybackCommand.Play, "test", null));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check whether Action property is type of MediaControlPlaybackCommand or not.")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.PlaylistCommand.Action A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Action_READ_ONLY()
+ {
+ Assert.IsInstanceOf<MediaControlPlaybackCommand>(_command.Action);
+ Assert.That(_command.Action, Is.EqualTo(_action));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check whether Position property is type of ulong or not.")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.PlaylistCommand.Position A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Position_READ_ONLY()
+ {
+ Assert.IsInstanceOf<ulong>(_command.Position);
+ Assert.That(_command.Position, Is.EqualTo(_position));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check whether Index property is type of string or not.")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.PlaylistCommand.Index A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Index_READ_ONLY()
+ {
+ Assert.IsInstanceOf<string>(_command.Index);
+ Assert.That(_command.Index, Is.EqualTo(_index));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check whether Name property is type of string or not.")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.PlaylistCommand.Name A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Name_READ_ONLY()
+ {
+ Assert.IsInstanceOf<string>(_command.Name);
+ Assert.That(_command.Name, Is.EqualTo(_playlistName));
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using NUnit.Framework;
+using System;
+
+namespace Tizen.Multimedia.Remoting.Tests
+{
+ [TestFixture]
+ [Description("Testing Tizen.Multimedia.Remoting.PlaylistCommandReceivedEventArgs class")]
+ public class PlaylistCommandReceivedEventArgsTests
+ {
+ [Test]
+ [Category("P1")]
+ [Description("Create PlaylistCommandReceivedEventArgs instance")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.PlaylistCommandReceivedEventArgs.PlaylistCommandReceivedEventArgs C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void PlaylistCommandReceivedEventArgs_CONSTRUCTOR()
+ {
+ Assert.That(() => new PlaylistCommandReceivedEventArgs(
+ new PlaylistCommand(MediaControlPlaybackCommand.Play, "test", "1")), Throws.Nothing);
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether PlaylistCommandReceivedEventArgs throws exception if parameter is invalid")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.PlaylistCommandReceivedEventArgs.PlaylistCommandReceivedEventArgs C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTN")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void PlaylistCommandReceivedEventArgs_THROWS_EXCEPTION()
+ {
+ Assert.Throws<ArgumentNullException>(() => new PlaylistCommandReceivedEventArgs(null));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check whether Command property is instance of PlaylistCommand or not.")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.PlaylistCommandReceivedEventArgs.Command A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Command_READ_ONLY()
+ {
+ var args = new PlaylistCommandReceivedEventArgs(
+ new PlaylistCommand(MediaControlPlaybackCommand.Play, "MyFavor", "ID1", 10U));
+
+ Assert.IsInstanceOf<PlaylistCommand>(args.Command);
+ Assert.That(args.Command.Action, Is.EqualTo(MediaControlPlaybackCommand.Play));
+ Assert.That(args.Command.Position, Is.EqualTo(10U));
+ Assert.That(args.Command.Index, Is.EqualTo("ID1"));
+ Assert.That(args.Command.Name, Is.EqualTo("MyFavor"));
+ }
+ }
+}
--- /dev/null
+using NUnit.Framework;
+using System;
+
+namespace Tizen.Multimedia.Remoting.Tests
+{
+ [TestFixture]
+ [Description("Testing Tizen.Multimedia.Remoting.PlaylistUpdatedEventArgs class")]
+ public class PlaylistUpdatedEventArgsTests
+ {
+ [SetUp]
+ public void SetUp()
+ {
+ MediaControlServer.Start();
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ if (MediaControlServer.IsRunning)
+ {
+ MediaControlServer.Stop();
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Create PlaylistUpdatedEventArgs instance")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.PlaylistUpdatedEventArgs.PlaylistUpdatedEventArgs C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void PlaylistUpdatedEventArgs_CONSTRUCTOR()
+ {
+ Assert.That(() => new PlaylistUpdatedEventArgs(MediaControlPlaylistMode.Updated, "test",
+ new MediaControlPlaylist("Song1")), Throws.Nothing);
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether PlaylistUpdatedEventArgs throws exception if parameter is invalid")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.PlaylistUpdatedEventArgs.PlaylistUpdatedEventArgs C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTN")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void PlaylistUpdatedEventArgs_THROWS_EXCEPTION()
+ {
+ Assert.Throws<ArgumentException>(() => new PlaylistUpdatedEventArgs(
+ MediaControlPlaylistMode.Updated - 1, "test", new MediaControlPlaylist("Song1")));
+
+ Assert.Throws<ArgumentNullException>(() => new PlaylistUpdatedEventArgs(
+ MediaControlPlaylistMode.Updated, null, new MediaControlPlaylist("Song1")));
+
+ Assert.Throws<ArgumentNullException>(() => new PlaylistUpdatedEventArgs(
+ MediaControlPlaylistMode.Updated, "test", null));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check whether Mode property is type of MediaControlPlaylistMode or not.")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.PlaylistUpdatedEventArgs.Mode A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Mode_READ_ONLY()
+ {
+ var args = new PlaylistUpdatedEventArgs(MediaControlPlaylistMode.Updated, "test",
+ new MediaControlPlaylist("Song1"));
+
+ Assert.IsInstanceOf<MediaControlPlaylistMode>(args.Mode);
+ Assert.That(args.Mode, Is.EqualTo(MediaControlPlaylistMode.Updated));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check whether Name property is type of string or not.")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.PlaylistUpdatedEventArgs.Name A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Name_READ_ONLY()
+ {
+ var args = new PlaylistUpdatedEventArgs(MediaControlPlaylistMode.Updated, "MyFavor",
+ new MediaControlPlaylist("Song1"));
+
+ Assert.IsInstanceOf<string>(args.Name);
+ Assert.That(args.Name, Is.EqualTo("MyFavor"));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check whether Playlist property is instance of MediaControlPlaylist or not.")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.PlaylistUpdatedEventArgs.Playlist A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Playlist_READ_ONLY()
+ {
+ var args = new PlaylistUpdatedEventArgs(MediaControlPlaylistMode.Updated, "test",
+ new MediaControlPlaylist("Song1"));
+
+ Assert.IsInstanceOf<MediaControlPlaylist>(args.Playlist);
+ Assert.That(args.Playlist.Name, Is.EqualTo("Song1"));
+ }
+ }
+}
using NUnit.Framework;
-using System.Collections.Generic;
+using System;
namespace Tizen.Multimedia.Remoting.Tests
{
{
[Test]
[Category("P1")]
- [Description("Constructor")]
+ [Description("Create RepeatModeCapabilityUpdatedEventArgs instance")]
[Property("SPEC", "Tizen.Multimedia.Remoting.RepeatModeCapabilityUpdatedEventArgs.RepeatModeCapabilityUpdatedEventArgs C")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "CONSTR")]
}
[Test]
+ [Category("P2")]
+ [Description("Check whether RepeatModeCapabilityUpdatedEventArgs throws exception if parameter is invalid")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.RepeatModeCapabilityUpdatedEventArgs.RepeatModeCapabilityUpdatedEventArgs C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTN")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void RepeatModeCapabilityUpdatedEventArgs_THROWS_EXCEPTION()
+ {
+ Assert.Throws<ArgumentException>(() => new RepeatModeCapabilityUpdatedEventArgs(MediaControlCapabilitySupport.Supported - 1));
+ Assert.Throws<ArgumentException>(() => new RepeatModeCapabilityUpdatedEventArgs(MediaControlCapabilitySupport.NotDecided + 1));
+ }
+
+ [Test]
[Category("P1")]
[Description("Is always not null")]
[Property("SPEC", "Tizen.Multimedia.Remoting.RepeatModeCapabilityUpdatedEventArgs.Support A")]
[Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
public void Support_READ_ONLY()
{
- Assert.That(() => new RepeatModeCapabilityUpdatedEventArgs(MediaControlCapabilitySupport.NotSupported).Support, Is.Not.Null);
+ var args = new RepeatModeCapabilityUpdatedEventArgs(MediaControlCapabilitySupport.Supported);
+
+ Assert.IsInstanceOf<MediaControlCapabilitySupport>(args.Support);
+ Assert.That(args.Support, Is.EqualTo(MediaControlCapabilitySupport.Supported));
}
}
}
+
--- /dev/null
+using NUnit.Framework;
+using System;
+using System.Linq;
+using Tizen.Applications;
+
+namespace Tizen.Multimedia.Remoting.Tests
+{
+ [TestFixture]
+ [Description("Testing Tizen.Multimedia.Remoting.RepeatModeCommand class")]
+ public class RepeatModeCommandTests
+ {
+ private MediaController _controller;
+ private MediaControllerManager _manager;
+ private RepeatModeCommand _command;
+
+ [SetUp]
+ public void SetUp()
+ {
+ MediaControlServer.Start();
+
+ _manager = new MediaControllerManager();
+ _controller = _manager.GetActiveControllers().Single(
+ c => c.ServerAppId == Application.Current.ApplicationInfo.ApplicationId);
+ _command = new RepeatModeCommand(MediaControlRepeatMode.Off);
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ if (MediaControlServer.IsRunning)
+ {
+ MediaControlServer.Stop();
+ }
+
+ _manager.Dispose();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Create RepeatModeCommand instance")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.RepeatModeCommand.RepeatModeCommand C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void RepeatModeCommand_CHECK_CREATE_CONSTRUCTOR()
+ {
+ Assert.IsNotNull(_command, "Object should not be null after initializing");
+ Assert.IsInstanceOf<RepeatModeCommand>(_command, "Should return RepeatModeCommand instance");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether RepeatModeCommand throws exception if parameter is invalid")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.RepeatModeCommand.RepeatModeCommand C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTN")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void RepeatModeCommand_THROWS_EXCEPTION()
+ {
+ Assert.Throws<ArgumentException>(() => new RepeatModeCommand(MediaControlRepeatMode.Off - 1));
+ Assert.Throws<ArgumentException>(() => new RepeatModeCommand(MediaControlRepeatMode.OneMedia + 1));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check whether Name property is type of MediaControlRepeatMode or not.")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.RepeatModeCommand.Mode A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Mode_READ_ONLY()
+ {
+ Assert.IsInstanceOf<MediaControlRepeatMode>(_command.Mode);
+ Assert.That(_command.Mode, Is.EqualTo(MediaControlRepeatMode.Off));
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using NUnit.Framework;
+using System;
+
+namespace Tizen.Multimedia.Remoting.Tests
+{
+ [TestFixture]
+ [Description("Testing Tizen.Multimedia.Remoting.RepeatModeCommandReceivedEventArgs class")]
+ public class RepeatModeCommandReceivedEventArgsTests
+ {
+ [Test]
+ [Category("P1")]
+ [Description("Create RepeatModeCommandReceivedEventArgs instance")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.RepeatModeCommandReceivedEventArgs.RepeatModeCommandReceivedEventArgs C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void RepeatModeCommandReceivedEventArgs_CONSTRUCTOR()
+ {
+ Assert.That(() => new RepeatModeCommandReceivedEventArgs(new RepeatModeCommand(MediaControlRepeatMode.Off)),
+ Throws.Nothing);
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether RepeatModeCommandReceivedEventArgs throws exception if parameter is invalid")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.RepeatModeCommandReceivedEventArgs.RepeatModeCommandReceivedEventArgs C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTN")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void RepeatModeCommandReceivedEventArgs_THROWS_EXCEPTION()
+ {
+ Assert.Throws<ArgumentNullException>(() => new RepeatModeCommandReceivedEventArgs(null));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check whether Command property is type of MediaControlRepeatMode or not.")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.RepeatModeCommandReceivedEventArgs.Command A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Command_READ_ONLY()
+ {
+ var args = new RepeatModeCommandReceivedEventArgs(
+ new RepeatModeCommand(MediaControlRepeatMode.Off));
+
+ Assert.IsInstanceOf<RepeatModeCommand>(args.Command);
+ Assert.That(args.Command.Mode, Is.EqualTo(MediaControlRepeatMode.Off));
+ }
+ }
+}
--- /dev/null
+using NUnit.Framework;
+using System;
+using System.Linq;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Tizen.Applications;
+
+namespace Tizen.Multimedia.Remoting.Tests
+{
+ [TestFixture]
+ [Description("Testing Tizen.Multimedia.Remoting.SearchCommand class")]
+ public class SearchCommandTests
+ {
+ private MediaController _controller;
+ private MediaControllerManager _manager;
+ private SearchCommand _command;
+
+ [SetUp]
+ public void SetUp()
+ {
+ MediaControlServer.Start();
+
+ _manager = new MediaControllerManager();
+ _controller = _manager.GetActiveControllers().Single(
+ c => c.ServerAppId == Application.Current.ApplicationInfo.ApplicationId);
+ _command = new SearchCommand(new MediaControlSearchCondition(MediaControlContentType.Image, "image", null));
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ if (MediaControlServer.IsRunning)
+ {
+ MediaControlServer.Stop();
+ }
+
+ _manager.Dispose();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Create SearchCommand instance with the set of search conditions")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.SearchCommand.SearchCommand C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("COVPARAM", "List<Tizen.Multimedia.Remoting.MediaControlSearchCondition>")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void SearchCommand_CHECK_CREATE_CONSTRUCTOR_WITH_LIST()
+ {
+ var command = new SearchCommand(new List<MediaControlSearchCondition>
+ {
+ new MediaControlSearchCondition(MediaControlContentType.Image, "test1", null),
+ new MediaControlSearchCondition(MediaControlContentType.Image, "test2", null)
+ });
+
+ Assert.IsNotNull(command, "Object should not be null after initializing");
+ Assert.IsInstanceOf<SearchCommand>(command, "Should return SearchCommand instance");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether PlaylistCommand throws exception if parameter is invalid")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.SearchCommand.SearchCommand C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTN")]
+ [Property("COVPARAM", "MediaControlSearchCondition")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void SearchCommand_CHECK_CREATE_CONSTRUCTOR()
+ {
+ List<MediaControlSearchCondition> condition = null;
+ Assert.Throws<ArgumentNullException>(() => new SearchCommand(condition));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Create SearchCommand instance with single search condition")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.SearchCommand.SearchCommand C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTN")]
+ [Property("COVPARAM", "MediaControlSearchCondition")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void SearchCommand_CHECK_CONTRUCTOR()
+ {
+ Assert.IsNotNull(_command, "Object should not be null after initializing");
+ Assert.IsInstanceOf<SearchCommand>(_command, "Should return SearchCommand instance");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether SearchCommand throws exception if parameter is invalid")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.SearchCommand.SearchCommand C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTN")]
+ [Property("COVPARAM", "MediaControlSearchCondition")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void SearchCommand_THROWS_EXCEPTION()
+ {
+ MediaControlSearchCondition condition = null;
+ Assert.Throws<ArgumentNullException>(() => new SearchCommand(condition));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check whether Conditions property is null or not.")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.SearchCommand.Conditions A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public async Task Conditions_CHECK_EVENT()
+ {
+ using (var eventWaiter = EventAwaiter<SearchCommandReceivedEventArgs>.Create())
+ {
+ MediaControlServer.SearchCommandReceived += eventWaiter;
+
+ await Task.Run(() =>
+ {
+ _controller.RequestAsync(new SearchCommand(
+ new MediaControlSearchCondition(MediaControlContentType.Music, MediaControlSearchCategory.Artist, "GD", null))
+ );
+ });
+
+ var args = await eventWaiter.GetResultAsync();
+ Assert.IsInstanceOf<IEnumerable<MediaControlSearchCondition>>(args.Command.Conditions);
+
+ foreach (var iter in args.Command.Conditions)
+ {
+ Assert.That(iter.ContentType, Is.EqualTo(MediaControlContentType.Music));
+ Assert.That(iter.Category, Is.EqualTo(MediaControlSearchCategory.Artist));
+ Assert.That(iter.Keyword, Is.EqualTo("GD"));
+ }
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check whether client and server communicate correctly using OnResponseCompleted internally.")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.SearchCommand.OnResponseCompleted M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public async Task OnResponseCompleted_AFTER_RESPONSE()
+ {
+ SearchCommand searchCommand = null;
+
+ MediaControlServer.SearchCommandReceived += (s, e) =>
+ {
+ searchCommand = e.Command;
+
+ Assert.That(() => MediaControlServer.Response(searchCommand, 0, new Bundle()), Throws.Nothing);
+ };
+
+ await Task.Run(() =>
+ {
+ _controller.RequestAsync(_command);
+ });
+ }
+ }
+}
\ No newline at end of file
using NUnit.Framework;
+using System;
+using System.Linq;
+using System.Threading;
+using Tizen.Applications;
+using System.Threading.Tasks;
namespace Tizen.Multimedia.Remoting.Tests
{
public class SearchCommandReceivedEventArgsTests
{
private MediaControlSearchCondition _searchCondition =
- new MediaControlSearchCondition(MediaControlContentType.Image, "image", null);
+ new MediaControlSearchCondition(MediaControlContentType.Music, MediaControlSearchCategory.Artist, "GD", null);
+
[Test]
[Category("P1")]
- [Description("Constructor")]
+ [Description("Create SearchCommandReceivedEventArgs instance")]
[Property("SPEC", "Tizen.Multimedia.Remoting.SearchCommandReceivedEventArgs.SearchCommandReceivedEventArgs C")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "CONSTR")]
}
[Test]
+ [Category("P2")]
+ [Description("Check whether SearchCommandReceivedEventArgs throws exception if parameter is invalid")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.SearchCommandReceivedEventArgs.SearchCommandReceivedEventArgs C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTN")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void SearchCommandReceivedEventArgs_THROWS_EXCEPTION()
+ {
+ Assert.Throws<ArgumentNullException>(() => new SearchCommandReceivedEventArgs(null));
+ }
+
+ [Test]
[Category("P1")]
[Description("Is always not null")]
[Property("SPEC", "Tizen.Multimedia.Remoting.SearchCommandReceivedEventArgs.Command A")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "PRO")]
[Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
- public void Command_READ_ONLY()
+ public async Task Command_READ_ONLY()
{
- Assert.That(() => new SearchCommandReceivedEventArgs(new SearchCommand(_searchCondition)).Command,
- Is.Not.Null);
+ CountdownEvent countdownEvent = new CountdownEvent(1);
+
+ MediaControlServer.Start();
+
+ using (var manager = new MediaControllerManager())
+ {
+ EventHandler<SearchCommandReceivedEventArgs> eventHandler = (s, e) =>
+ {
+ foreach (var iter in e.Command.Conditions)
+ {
+ Assert.That(iter.ContentType, Is.EqualTo(MediaControlContentType.Music));
+ Assert.That(iter.Category, Is.EqualTo(MediaControlSearchCategory.Artist));
+ Assert.That(iter.Keyword, Is.EqualTo("GD"));
+
+ countdownEvent.Signal();
+ }
+ };
+
+ var controller = manager.GetActiveControllers().Single(
+ c => c.ServerAppId == Application.Current.ApplicationInfo.ApplicationId);
+
+ MediaControlServer.SearchCommandReceived += eventHandler;
+
+ await Task.Run(() =>
+ {
+ controller.RequestAsync(new SearchCommand(new MediaControlSearchCondition(
+ MediaControlContentType.Music, MediaControlSearchCategory.Artist, "GD", null))
+ );
+ });
+
+ countdownEvent.Wait(4000);
+ }
+
+ if (MediaControlServer.IsRunning)
+ {
+ MediaControlServer.Stop();
+ }
+
+ countdownEvent.Dispose();
}
}
}
using NUnit.Framework;
+using System;
namespace Tizen.Multimedia.Remoting.Tests
{
{
[Test]
[Category("P1")]
- [Description("Constructor")]
+ [Description("Create ShuffleModeCapabilityUpdatedEventArgs instance")]
[Property("SPEC", "Tizen.Multimedia.Remoting.ShuffleModeCapabilityUpdatedEventArgs.ShuffleModeCapabilityUpdatedEventArgs C")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "CONSTR")]
}
[Test]
+ [Category("P2")]
+ [Description("Check whether ShuffleModeCapabilityUpdatedEventArgs throws exception if parameter is invalid")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.ShuffleModeCapabilityUpdatedEventArgs.ShuffleModeCapabilityUpdatedEventArgs C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTN")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void ShuffleModeCapabilityUpdatedEventArgs_THROWS_EXCEPTION()
+ {
+ Assert.Throws<ArgumentException>(() => new ShuffleModeCapabilityUpdatedEventArgs(MediaControlCapabilitySupport.Supported - 1));
+ Assert.Throws<ArgumentException>(() => new ShuffleModeCapabilityUpdatedEventArgs(MediaControlCapabilitySupport.NotDecided + 1));
+ }
+
+ [Test]
[Category("P1")]
- [Description("Is always not null")]
+ [Description("Check whether Support property is instance of MediaControlCapabilitySupport or not.")]
[Property("SPEC", "Tizen.Multimedia.Remoting.ShuffleModeCapabilityUpdatedEventArgs.Support A")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "PRO")]
[Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
public void Support_READ_ONLY()
{
- Assert.That(() => new ShuffleModeCapabilityUpdatedEventArgs(MediaControlCapabilitySupport.NotSupported).Support,
- Is.Not.Null);
+ var args = new ShuffleModeCapabilityUpdatedEventArgs(MediaControlCapabilitySupport.Supported);
+
+ Assert.IsInstanceOf<MediaControlCapabilitySupport>(args.Support);
+ Assert.That(args.Support, Is.EqualTo(MediaControlCapabilitySupport.Supported));
}
}
}
--- /dev/null
+using NUnit.Framework;
+using System.Linq;
+using System.Threading.Tasks;
+using Tizen.Applications;
+
+namespace Tizen.Multimedia.Remoting.Tests
+{
+ [TestFixture]
+ [Description("Testing Tizen.Multimedia.Remoting.ShuffleModeCommand class")]
+ public class ShuffleModeCommandTests
+ {
+ private MediaController _controller;
+ private MediaControllerManager _manager;
+ private ShuffleModeCommand _command;
+
+ [SetUp]
+ public void SetUp()
+ {
+ MediaControlServer.Start();
+
+ _manager = new MediaControllerManager();
+ _controller = _manager.GetActiveControllers().Single(
+ c => c.ServerAppId == Application.Current.ApplicationInfo.ApplicationId);
+ _command = new ShuffleModeCommand(true);
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ if (MediaControlServer.IsRunning)
+ {
+ MediaControlServer.Stop();
+ }
+
+ _manager.Dispose();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Create ShuffleModeCommand instance")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.ShuffleModeCommand.ShuffleModeCommand C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void ShuffleModeCommand_CHECK_CREATE_CONSTRUCTOR()
+ {
+ Assert.IsNotNull(_command, "Object should not be null after initializing");
+ Assert.IsInstanceOf<ShuffleModeCommand>(_command, "Should return ShuffleModeCommand instance");
+
+ var command = new ShuffleModeCommand(false);
+ Assert.IsNotNull(command, "Object should not be null after initializing");
+ Assert.IsInstanceOf<ShuffleModeCommand>(command, "Should return ShuffleModeCommand instance");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check whether Command property is type of bool or not.")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.ShuffleModeCommand.Enabled A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Enabled_READ_ONLY()
+ {
+ Assert.IsInstanceOf<bool>(_command.Enabled);
+ Assert.That(_command.Enabled, Is.EqualTo(true));
+
+ var command = new ShuffleModeCommand(false);
+ Assert.IsInstanceOf<bool>(command.Enabled);
+ Assert.That(command.Enabled, Is.EqualTo(false));
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using NUnit.Framework;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+using System;
+using System.Linq;
+namespace Tizen.Multimedia.Remoting.Tests
+{
+ [TestFixture]
+ [Description("Testing Tizen.Multimedia.Remoting.ShuffleModeCommandReceivedEventArgs class")]
+ public class ShuffleModeCommandReceivedEventArgsTests
+ {
+ [Test]
+ [Category("P1")]
+ [Description("Create ShuffleModeCommandReceivedEventArgs instance")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.ShuffleModeCommandReceivedEventArgs.ShuffleModeCommandReceivedEventArgs C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void ShuffleModeCommandReceivedEventArgs_CONSTRUCTOR()
+ {
+ Assert.That(() => new ShuffleModeCommandReceivedEventArgs(new ShuffleModeCommand(false)),
+ Throws.Nothing);
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether ShuffleModeCommandReceivedEventArgs throws exception if parameter is invalid")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.ShuffleModeCommandReceivedEventArgs.ShuffleModeCommandReceivedEventArgs C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTN")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void ShuffleModeCommandReceivedEventArgs_THROWS_EXCEPTION()
+ {
+ Assert.Throws<ArgumentNullException>(() => new ShuffleModeCommandReceivedEventArgs(null));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check whether Command property is instance of ShuffleModeCommand or not.")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.ShuffleModeCommandReceivedEventArgs.Command A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Command_READ_ONLY()
+ {
+ var args = new ShuffleModeCommandReceivedEventArgs(new ShuffleModeCommand(false));
+
+ Assert.IsInstanceOf<ShuffleModeCommand>(args.Command);
+ Assert.That(args.Command.Enabled, Is.EqualTo(false));
+ }
+ }
+}