[smuxi/stable: 1/5] Engine-Tests: improve TestMessage()



commit 28acf05824c389c2f28c2dd72098aa600f595585
Author: Andres G. Aragoneses <knocte gmail com>
Date:   Thu Oct 20 00:10:47 2016 +0800

    Engine-Tests: improve TestMessage()
    
    Compare the subparts of the MessageModel first, otherwise this
    could fail in a way in which NUnit just compares the .ToString()
    result of each, which could be the same and be very confusing.

 src/Engine-Tests/MessageBuilderTests.cs |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/src/Engine-Tests/MessageBuilderTests.cs b/src/Engine-Tests/MessageBuilderTests.cs
index c49dfa0..cc3d405 100644
--- a/src/Engine-Tests/MessageBuilderTests.cs
+++ b/src/Engine-Tests/MessageBuilderTests.cs
@@ -316,6 +316,11 @@ namespace Smuxi.Engine
             builder.TimeStamp = DateTime.MinValue;
             builder.AppendMessage(message);
             var actualMsg = builder.ToMessage();
+            Assert.AreEqual(expectedMsg.GetType(), actualMsg.GetType());
+            Assert.AreEqual(expectedMsg.MessageParts.Count, actualMsg.MessageParts.Count);
+            for (int i = 0; i < expectedMsg.MessageParts.Count; i++) {
+                Assert.AreEqual(expectedMsg.MessageParts[i].GetType(), actualMsg.MessageParts[i].GetType());
+            }
             Assert.AreEqual(expectedMsg, actualMsg);
         }
 


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