[MediaPlayer][Non-ACR] fix codes to handle exceptions properly 34/214834/3
authorruble <just.nam@samsung.com>
Fri, 27 Sep 2019 01:58:44 +0000 (10:58 +0900)
committerruble <just.nam@samsung.com>
Tue, 1 Oct 2019 05:38:31 +0000 (14:38 +0900)
Change-Id: I3a365637d68d7d485a5dd39fb6cc305e1022b0f0

tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayer.cs

index a617735..411cd4a 100755 (executable)
@@ -1891,7 +1891,7 @@ namespace Tizen.Multimedia.Tests
                 var player = GetIdlePlayer();
                 player.SetSource(Constants.VideoFileSource);
 
-                Assert.That(() => player.EnableExportingVideoFrame(), Throws.Nothing);
+                player.EnableExportingVideoFrame();
             }
             catch(NotSupportedException)
             {
@@ -1899,6 +1899,14 @@ namespace Tizen.Multimedia.Tests
                 {
                     Assert.Pass($"The feature({Features.RawVideo} is not supported.");
                 }
+                else
+                {
+                    Assert.Fail("Feature is supported but exception is invoked.");
+                }
+            }
+            catch (Exception)
+            {
+                Assert.Fail("It should not throw exception");
             }
         }
 
@@ -1915,8 +1923,11 @@ namespace Tizen.Multimedia.Tests
             {
                 var player = await GetPreparedPlayer(Constants.VideoFileSource);
 
-                Assert.That(() => player.EnableExportingVideoFrame(),
-                    Throws.InvalidOperationException);
+                player.EnableExportingVideoFrame();
+            }
+            catch (InvalidOperationException)
+            {
+                Assert.Pass("the proper error occured.");
             }
             catch (NotSupportedException)
             {
@@ -1924,6 +1935,14 @@ namespace Tizen.Multimedia.Tests
                 {
                     Assert.Pass($"The feature({Features.RawVideo} is not supported.");
                 }
+                else
+                {
+                    Assert.Fail("Feature is supported but exception is invoked.");
+                }
+            }
+            catch (Exception)
+            {
+                Assert.Fail("It should not throw exception.");
             }
         }
 
@@ -1940,8 +1959,11 @@ namespace Tizen.Multimedia.Tests
             {
                 GetIdlePlayer().Dispose();
 
-                Assert.That(() => TestPlayer.EnableExportingVideoFrame(),
-                    Throws.TypeOf<ObjectDisposedException>());
+                TestPlayer.EnableExportingVideoFrame();
+            }
+            catch (ObjectDisposedException)
+            {
+                Assert.Pass("the proper error occured");
             }
             catch (NotSupportedException)
             {
@@ -1949,6 +1971,14 @@ namespace Tizen.Multimedia.Tests
                 {
                     Assert.Pass($"The feature({Features.RawVideo} is not supported.");
                 }
+                else
+                {
+                    Assert.Fail("Feature is supported but exception is invoked.");
+                }
+            }
+            catch (Exception)
+            {
+                Assert.Fail("It should not throw exception.");
             }
         }
 
@@ -1964,11 +1994,11 @@ namespace Tizen.Multimedia.Tests
             try
             {
                 var player = GetIdlePlayer();
-                Assert.That(() => player.DisableExportingVideoFrame(), Throws.Nothing);
+                player.DisableExportingVideoFrame();
 
                 player.SetSource(Constants.VideoFileSource);
                 await player.PrepareAsync();
-                Assert.That(() => player.DisableExportingVideoFrame(), Throws.Nothing);
+                player.DisableExportingVideoFrame();
             }
             catch (NotSupportedException)
             {
@@ -1976,6 +2006,14 @@ namespace Tizen.Multimedia.Tests
                 {
                     Assert.Pass($"The feature({Features.RawVideo} is not supported.");
                 }
+                else
+                {
+                    Assert.Fail("Feature is supported but exception is invoked.");
+                }
+            }
+            catch (Exception)
+            {
+                Assert.Fail("It should not throw exception");
             }
         }
 
@@ -1992,8 +2030,11 @@ namespace Tizen.Multimedia.Tests
             {
                 var player = await GetPlayingPlayer(Constants.VideoFileSource);
 
-                Assert.That(() => player.DisableExportingVideoFrame(),
-                    Throws.InvalidOperationException);
+                player.DisableExportingVideoFrame();
+            }
+            catch (InvalidOperationException)
+            {
+                Assert.Pass("the proper error occured.");
             }
             catch (NotSupportedException)
             {
@@ -2001,6 +2042,14 @@ namespace Tizen.Multimedia.Tests
                 {
                     Assert.Pass($"The feature({Features.RawVideo} is not supported.");
                 }
+                else
+                {
+                    Assert.Fail("Feature is supported but exception is invoked.");
+                }
+            }
+            catch (Exception)
+            {
+                Assert.Fail("It should not throw exception.");
             }
         }
 
@@ -2017,7 +2066,11 @@ namespace Tizen.Multimedia.Tests
             {
                 GetIdlePlayer().Dispose();
 
-                Assert.That(() => TestPlayer.DisableExportingVideoFrame(), Throws.TypeOf<ObjectDisposedException>());
+                TestPlayer.DisableExportingVideoFrame();
+            }
+            catch (ObjectDisposedException)
+            {
+                Assert.Pass("the proper error occured.");
             }
             catch (NotSupportedException)
             {
@@ -2025,6 +2078,14 @@ namespace Tizen.Multimedia.Tests
                 {
                     Assert.Pass($"The feature({Features.RawVideo} is not supported.");
                 }
+                else
+                {
+                    Assert.Fail("Feature is supported but exception is invoked.");
+                }
+            }
+            catch (Exception)
+            {
+                Assert.Fail("It should not throw exception.");
             }
         }
         #endregion