[Test]
[Category("P1")]
- [Description("Thows nothing when RequestAsync to client")]
+ [Description("Throws nothing when RequestAsync to client")]
[Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.RequestAsync M")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "MR")]
[Test]
[Category("P1")]
- [Description("Thows nothing when response to client")]
+ [Description("Throws nothing when response to client")]
[Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.Response M")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "MR")]
Assert.Throws<ArgumentNullException>(() => MediaControlServer.Response(null, 0));
}
+ [Test]
+ [Category("P1")]
+ [Description("Throws nothing when response to client")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.Response M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("COVPARAM", "Command, MediaControlResult")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public async Task Response_WITH_MEDIACONTROLRESULT_THROWS_NOTHING()
+ {
+ using (var manager = new MediaControllerManager())
+ {
+ var controller = manager.GetActiveControllers().Single(
+ c => c.ServerAppId == Application.Current.ApplicationInfo.ApplicationId);
+
+ foreach(MediaControlResult result in Enum.GetValues(typeof(MediaControlResult)))
+ {
+ EventHandler<CustomCommandReceivedEventArgs> eventHandler = (s, e) =>
+ {
+ var customCommand = e.Command;
+
+ Assert.That(() => MediaControlServer.Response(customCommand, result), Throws.Nothing);
+ };
+
+ try
+ {
+ MediaControlServer.CustomCommandReceived += eventHandler;
+
+ await Task.Run(() =>
+ {
+ var serverResult = controller.RequestCommandAsync(new CustomCommand("Custom"));
+ Assert.AreEqual(serverResult.Result.result, (int)result, "Should be same value");
+ });
+ }
+ 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, MediaControlResult")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Response_WITH_MEDIACONTROLRESULT_THROWS_INVALIDOPERATIONEXCEPTION()
+ {
+ MediaControlServer.Stop();
+
+ Assert.That(() => MediaControlServer.Response(new CustomCommand("custom"),
+ MediaControlResult.Success), Throws.InvalidOperationException);
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether Response throws exception if argument is null")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.Response M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "Command, MediaControlResult")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Response_WITH_MEDIACONTROLRESULT_THROWS_ARGUMENTNULLEXCEPTION()
+ {
+ Assert.Throws<ArgumentNullException>(
+ () => MediaControlServer.Response(null, MediaControlResult.Success));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Throws nothing when response to client")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.Response M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("COVPARAM", "Command, MediaControlResult, Bundle")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public async Task Response_WITH_MEDIACONTROLRESULT_BUNDLE_THROWS_NOTHING()
+ {
+ using (var manager = new MediaControllerManager())
+ {
+ var controller = manager.GetActiveControllers().Single(
+ c => c.ServerAppId == Application.Current.ApplicationInfo.ApplicationId);
+
+ foreach (MediaControlResult result in Enum.GetValues(typeof(MediaControlResult)))
+ {
+ EventHandler<CustomCommandReceivedEventArgs> eventHandler = (s, e) =>
+ {
+ var customCommand = e.Command;
+
+ Assert.That(() => MediaControlServer.Response(customCommand, result, new Bundle()),
+ Throws.Nothing);
+ };
+
+ try
+ {
+ MediaControlServer.CustomCommandReceived += eventHandler;
+
+ await Task.Run(() =>
+ {
+ var serverResult = controller.RequestCommandAsync(new CustomCommand("Custom"));
+ Assert.AreEqual(serverResult.Result.result, (int)result, "Should be same value");
+ });
+ }
+ 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, MediaControlResult, Bundle")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Response_WITH_MEDIACONTROLRESULT_BUNDLE_THROWS_INVALIDOPERATIONEXCEPTION()
+ {
+ MediaControlServer.Stop();
+
+ Assert.That(() => MediaControlServer.Response(new CustomCommand("custom"),
+ MediaControlResult.Success, new Bundle()), Throws.InvalidOperationException);
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether Response throws exception if argument is null")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaControlServer.Response M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "Command, MediaControlResult, Bundle")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Response_WITH_MEDIACONTROLRESULT_BUNDLE_THROWS_ARGUMENTNULLEXCEPTION()
+ {
+ Assert.Throws<ArgumentNullException>(
+ () => MediaControlServer.Response(null, MediaControlResult.Success, new Bundle()));
+ }
+
[Test]
[Category("P1")]
[Description("Returns index of current playing media")]
Assert.That(() => _controller.Response(null, 0, new Bundle()), 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, MediaControlResult")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public async Task Response_WITH_MEDIACONTROLRESULT_THROWS_NOTHING()
+ {
+ CustomCommand customCommand = null;
+
+ foreach (MediaControlResult result in Enum.GetValues(typeof(MediaControlResult)))
+ {
+ EventHandler<CustomCommandReceivedEventArgs> eventHandler = (s, e) =>
+ {
+ customCommand = e.Command;
+
+ Assert.That(() => _controller.Response(customCommand, result), Throws.Nothing);
+ };
+
+ try
+ {
+ _controller.CustomCommandReceived += eventHandler;
+
+ await Task.Run(() =>
+ {
+ var clientResult = MediaControlServer.RequestCommandAsync(new CustomCommand("CustomCommand"),
+ Application.Current.ApplicationInfo.ApplicationId);
+
+ Assert.AreEqual(clientResult.Result.result, (int)result, "Should be same value");
+ });
+ }
+ finally
+ {
+ _controller.CustomCommandReceived -= eventHandler;
+ }
+ }
+ }
+
+ [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, MediaControlResult")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Response_WITH_MEDIACONTROLRESULT_THROWS_INVALIDOPERATIONEXCEPTION()
+ {
+ MediaControlServer.Stop();
+
+ Assert.That(() => _controller.Response(new CustomCommand("Custom"),
+ MediaControlResult.Success), Throws.InvalidOperationException);
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether Response throws exception if argument is null")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaController.Response M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "Command, MediaControlResult")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Response_WITH_MEDIACONTROLRESULT_THROWS_ARGUMENTNULLEXCEPTION()
+ {
+ Assert.That(() => _controller.Response(null,
+ MediaControlResult.Success), 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, MediaControlResult, Bundle")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public async Task Response_WITH_MEDIACONTROLRESULT_BUNDLE_THROWS_NOTHING()
+ {
+ CustomCommand customCommand = null;
+
+ foreach (MediaControlResult result in Enum.GetValues(typeof(MediaControlResult)))
+ {
+ EventHandler<CustomCommandReceivedEventArgs> eventHandler = (s, e) =>
+ {
+ customCommand = e.Command;
+
+ Assert.That(() => _controller.Response(customCommand, result, new Bundle()), Throws.Nothing);
+ };
+
+ try
+ {
+ _controller.CustomCommandReceived += eventHandler;
+
+ await Task.Run(() =>
+ {
+ var clientResult = MediaControlServer.RequestCommandAsync(new CustomCommand("CustomCommand"),
+ Application.Current.ApplicationInfo.ApplicationId);
+
+ Assert.AreEqual(clientResult.Result.result, (int)result, "Should be same value");
+ });
+ }
+ finally
+ {
+ _controller.CustomCommandReceived -= eventHandler;
+ }
+ }
+ }
+
+ [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, MediaControlResult, Bundle")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Response_WITH_MEDIACONTROLRESULT_BUNDLE_THROWS_INVALIDOPERATIONEXCEPTION()
+ {
+ MediaControlServer.Stop();
+
+ Assert.That(() => _controller.Response(new CustomCommand("Custom"),
+ MediaControlResult.Success, new Bundle()), Throws.InvalidOperationException);
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether Response throws exception if argument is null")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaController.Response M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "Command, MediaControlResult, Bundle")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Response_WITH_MEDIACONTROLRESULT_BUNDLE_THROWS_ARGUMENTNULLEXCEPTION()
+ {
+ Assert.That(() => _controller.Response(null,
+ MediaControlResult.Success, new Bundle()), Throws.ArgumentNullException);
+ }
+
[Test]
[Category("P1")]
[Description("Invoked when server sends custom command")]