[longomatch] Add more tests
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Add more tests
- Date: Wed, 18 Mar 2015 14:37:10 +0000 (UTC)
commit 1de0ab02b97f69f79dedb22b3665363e8c560934
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Fri Mar 6 18:24:53 2015 +0100
Add more tests
Tests/Core/Store/TestPlayer.cs | 30 +++++++++++++++++++++---------
Tests/Core/Store/TestTag.cs | 27 +++++++++++++++++++++++++--
Tests/Core/Store/TestTimeNode.cs | 7 +++++++
3 files changed, 53 insertions(+), 11 deletions(-)
---
diff --git a/Tests/Core/Store/TestPlayer.cs b/Tests/Core/Store/TestPlayer.cs
index b5e093c..6516303 100644
--- a/Tests/Core/Store/TestPlayer.cs
+++ b/Tests/Core/Store/TestPlayer.cs
@@ -23,16 +23,17 @@ using LongoMatch.Core.Store;
namespace Tests.Core.Store
{
- [TestFixture()]
+ [TestFixture ()]
public class TestPlayer
{
- [Test()]
+ [Test ()]
public void TestSerialization ()
{
- Player player = new Player {Name="andoni", Position="runner",
+ Player player = new Player {Name = "andoni", Position = "runner",
Number = 5, Birthday = new DateTime (1984, 6, 11),
Nationality = "spanish", Height = 1.73f, Weight = 70,
- Playing = true, Mail = "test test"};
+ Playing = true, Mail = "test test", Color = Color.Red
+ };
Utils.CheckSerialization (player);
@@ -46,16 +47,27 @@ namespace Tests.Core.Store
Assert.AreEqual (player.Weight, newPlayer.Weight);
Assert.AreEqual (player.Playing, newPlayer.Playing);
Assert.AreEqual (player.Mail, newPlayer.Mail);
+ Assert.IsNull (newPlayer.Color);
}
-
- [Test()]
+
+ [Test ()]
+ public void TestToString ()
+ {
+ Player player = new Player { Name = "andoni", LastName = "morales", Number=1 };
+ Assert.AreEqual ("1-andoni morales", player.ToString ());
+ player.NickName = "ylatuya";
+ Assert.AreEqual ("1-ylatuya", player.ToString ());
+ }
+
+ [Test ()]
public void TestPhoto ()
{
- Player player = new Player {Name="andoni", Position="runner",
+ Player player = new Player {Name = "andoni", Position = "runner",
Number = 5, Birthday = new DateTime (1984, 6, 11),
Nationality = "spanish", Height = 1.73f, Weight = 70,
- Playing = true};
- player.Photo = Utils.LoadImageFromFile();
+ Playing = true
+ };
+ player.Photo = Utils.LoadImageFromFile ();
Utils.CheckSerialization (player);
Assert.AreEqual (player.Photo.Width, 16);
Assert.AreEqual (player.Photo.Height, 16);
diff --git a/Tests/Core/Store/TestTag.cs b/Tests/Core/Store/TestTag.cs
index 9b39fc0..bf33c15 100644
--- a/Tests/Core/Store/TestTag.cs
+++ b/Tests/Core/Store/TestTag.cs
@@ -17,6 +17,7 @@
//
using NUnit.Framework;
using System;
+using LongoMatch.Core.Store;
namespace Tests.Core.Store
{
@@ -24,9 +25,31 @@ namespace Tests.Core.Store
public class TestTag
{
[Test ()]
- [Ignore ("Not implemented")]
- public void TestCase ()
+ public void TestSerialization ()
{
+ Tag tag = new Tag ("name", "grp");
+ tag.HotKey = new HotKey { Modifier = 2, Key = 1 };
+ Utils.CheckSerialization (tag);
+
+ Tag tag2 = Utils.SerializeDeserialize (tag);
+ Assert.AreEqual (tag.Value, tag2.Value);
+ Assert.AreEqual (tag.Group, tag2.Group);
+ Assert.AreEqual (tag.HotKey, tag2.HotKey);
+ }
+
+ [Test ()]
+ public void TestEquals ()
+ {
+ Tag tag1 = new Tag ("name", "grp");
+ Tag tag2 = new Tag ("name", "grp");
+ Tag tag3 = new Tag ("name1", "grp");
+ Tag tag4 = new Tag ("name", "grp1");
+
+ Assert.IsFalse (tag1.Equals (null));
+ Assert.IsFalse (tag1.Equals ("string"));
+ Assert.IsFalse (tag1.Equals (tag3));
+ Assert.IsFalse (tag1.Equals (tag4));
+ Assert.IsTrue (tag1.Equals (tag2));
}
}
}
diff --git a/Tests/Core/Store/TestTimeNode.cs b/Tests/Core/Store/TestTimeNode.cs
index 9c48f06..1133d58 100644
--- a/Tests/Core/Store/TestTimeNode.cs
+++ b/Tests/Core/Store/TestTimeNode.cs
@@ -155,6 +155,13 @@ namespace Tests.Core.Store
tn2.Start = new Time (2000);
tn2.Stop = new Time (2100);
Assert.IsNull (tn1.Intersect (tn2));
+
+ /* Intersection */
+ tn2.Start = new Time (1500);
+ tn2.Stop = new Time (2400);
+ TimeNode tn3 = tn1.Intersect (tn2);
+ Assert.AreEqual (1000, tn3.Start.MSeconds);
+ Assert.AreEqual (2400, tn3.Start.MSeconds);
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]