[banshee] MediaEngineTests: improve assertion info even more



commit 2bbda44e739bbf6ab3ee71575fd9f35001c68d8b
Author: Andrés G. Aragoneses <knocte gmail com>
Date:   Wed Jan 22 10:42:14 2014 +0100

    MediaEngineTests: improve assertion info even more
    
    In case there was a discrepancy between two events, and one of
    them was a PlayerEvent.StateChange, it is very handy to know
    the underlying State that the event is informing about.

 .../Banshee.Services/Banshee.MediaEngine/Tests.cs  |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/src/Core/Banshee.Services/Banshee.MediaEngine/Tests.cs 
b/src/Core/Banshee.Services/Banshee.MediaEngine/Tests.cs
index 497c46e..28ebe62 100644
--- a/src/Core/Banshee.Services/Banshee.MediaEngine/Tests.cs
+++ b/src/Core/Banshee.Services/Banshee.MediaEngine/Tests.cs
@@ -224,7 +224,14 @@ namespace Banshee.MediaEngine
                         var evnt = (states[result_count] as PlayerEvent?) ?? PlayerEvent.StateChange;
                         var state = states[result_count] as PlayerState?;
 
-                        Assert.That (last_event, Is.EqualTo (evnt), String.Format ("Event[{0}] doesn't 
match", result_count));
+                        var evnt_or_state_desc = (evnt == PlayerEvent.StateChange ?
+                            evnt.ToString() + ">" + states[result_count].ToString () : evnt.ToString ());
+                        var last_evnt_or_state_desc = (last_event == PlayerEvent.StateChange ?
+                            last_event.ToString () + ">" + sca.Current.ToString () : last_event.ToString ());
+
+                        Assert.That (last_event, Is.EqualTo (evnt),
+                            String.Format ("Event[{0}] doesn't match (should be {1}, it was {2})",
+                                           result_count, evnt_or_state_desc, last_evnt_or_state_desc));
                         if (state != null) {
                             Assert.That (last_state, Is.EqualTo (state), String.Format ("State[{0}] doesn't 
match", result_count));
                         }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]