[smuxi] Engine(-Tests): fixed (de)serializing URLs with text in MessageDtoModelV1 correctly
- From: Mirco M. M. Bauer <mmmbauer src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [smuxi] Engine(-Tests): fixed (de)serializing URLs with text in MessageDtoModelV1 correctly
- Date: Tue, 4 Mar 2014 19:16:55 +0000 (UTC)
commit fe1482ccce9aa931f4fc83dc3439e8da66e65e3c
Author: Mirco Bauer <meebey meebey net>
Date: Tue Mar 4 20:12:59 2014 +0100
Engine(-Tests): fixed (de)serializing URLs with text in MessageDtoModelV1 correctly
src/Engine-Tests/MessageDtoModelV1Tests.cs | 19 +++++++++++++++++--
src/Engine/Messages/Dto/MessageDtoModelV1.cs | 6 ++++--
2 files changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/src/Engine-Tests/MessageDtoModelV1Tests.cs b/src/Engine-Tests/MessageDtoModelV1Tests.cs
index 5bf598d..5c9d9e5 100644
--- a/src/Engine-Tests/MessageDtoModelV1Tests.cs
+++ b/src/Engine-Tests/MessageDtoModelV1Tests.cs
@@ -1,6 +1,6 @@
// Smuxi - Smart MUltipleXed Irc
//
-// Copyright (c) 2012 Mirco Bauer <meebey meebey net>
+// Copyright (c) 2012, 2014 Mirco Bauer <meebey meebey net>
//
// Full GPL License: <http://www.gnu.org/licenses/gpl.txt>
//
@@ -51,18 +51,33 @@ namespace Smuxi.Engine
var topic = "Smuxi the IRC client for sophisticated users: http://smuxi.org/ | Smuxi 0.7.2.2
'Lovegood' released (2010-07-27) http://bit.ly/9nvsZF | FAQ: http://smuxi.org/faq/ | Deutsch? -> #smuxi.de |
EspaƱol? -> #smuxi.es | Smuxi @ FOSDEM 2010 talk: http://bit.ly/anHJfm";
builder = new MessageBuilder();
builder.AppendMessage(topic);
+ builder.AppendText(" ");
+ builder.AppendUrl("https://www.smuxi.org/issues/show/428", "smuxi#428");
ComplexMessage = builder.ToMessage();
ComplexMessageJson = JsonSerializer.SerializeToString(ComplexMessage);
ComplexMessageDtoV1 =
JsonSerializer.DeserializeFromString<MessageDtoModelV1>(ComplexMessageJson);
}
[Test]
- public void SerializeDeserialize()
+ public void SerializeDeserializeSimpleMessage()
{
var dtoMsg = new MessageDtoModelV1(SimpleMessage);
var json = JsonSerializer.SerializeToString(dtoMsg);
var dtoMsg2 = JsonSerializer.DeserializeFromString<MessageDtoModelV1>(json);
Assert.AreEqual(dtoMsg.ToMessage(), dtoMsg2.ToMessage());
+ Assert.AreEqual(SimpleMessage, dtoMsg.ToMessage());
+ Assert.AreEqual(SimpleMessage, dtoMsg2.ToMessage());
+ }
+
+ [Test]
+ public void SerializeDeserializeComplexMessage()
+ {
+ var dtoMsg = new MessageDtoModelV1(ComplexMessage);
+ var json = JsonSerializer.SerializeToString(dtoMsg);
+ var dtoMsg2 = JsonSerializer.DeserializeFromString<MessageDtoModelV1>(json);
+ Assert.AreEqual(dtoMsg.ToMessage(), dtoMsg2.ToMessage());
+ Assert.AreEqual(ComplexMessage, dtoMsg.ToMessage());
+ Assert.AreEqual(ComplexMessage, dtoMsg2.ToMessage());
}
[Test]
diff --git a/src/Engine/Messages/Dto/MessageDtoModelV1.cs b/src/Engine/Messages/Dto/MessageDtoModelV1.cs
index 3a14717..0c77441 100644
--- a/src/Engine/Messages/Dto/MessageDtoModelV1.cs
+++ b/src/Engine/Messages/Dto/MessageDtoModelV1.cs
@@ -1,6 +1,6 @@
// Smuxi - Smart MUltipleXed Irc
//
-// Copyright (c) 2012 Mirco Bauer <meebey meebey net>
+// Copyright (c) 2012, 2014 Mirco Bauer <meebey meebey net>
//
// Full GPL License: <http://www.gnu.org/licenses/gpl.txt>
//
@@ -69,7 +69,8 @@ namespace Smuxi.Engine.Dto
break;
case "URL":
var urlPart = new UrlMessagePartModel() {
- Url = msgPart.Url
+ Url = msgPart.Url,
+ Text = msgPart.Text
};
part = urlPart;
break;
@@ -135,6 +136,7 @@ namespace Smuxi.Engine.Dto
var urlPart = (UrlMessagePartModel) part;
Type = "URL";
Url = urlPart.Url;
+ Text = urlPart.Text;
}
if (part is ImageMessagePartModel) {
var imagePart = (ImageMessagePartModel) part;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]