From 04ba65a4bdc907492fd88720cc7d3b8d3d17589d Mon Sep 17 00:00:00 2001 From: Patrick Madden Date: Mon, 17 Dec 2012 12:57:04 -0800 Subject: [PATCH] Added Bulk* Serialization Tests --- Client.Tests/JsonSerializationTests.cs | 45 ++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/Client.Tests/JsonSerializationTests.cs b/Client.Tests/JsonSerializationTests.cs index ef4f4b4..a7b9c4a 100644 --- a/Client.Tests/JsonSerializationTests.cs +++ b/Client.Tests/JsonSerializationTests.cs @@ -121,5 +121,50 @@ public void EmptyAttributes() Assert.AreEqual("{\"id\":\"series-id\",\"key\":\"series-key\",\"name\":null,\"attributes\":{},\"tags\":null}", result); } } + + [TestFixture] + public class BulkIdSerializationTests + { + [Test] + public void SmokeTest() + { + BulkPoint bdp = new BulkIdPoint("point-id", 12.34); + var result = JsonSerializationTests.serializer.Serialize(bdp); + + Assert.AreEqual("{\"id\":\"point-id\",\"v\":12.34}", result); + } + } + + [TestFixture] + public class BulkKeySerializationTests + { + [Test] + public void SmokeTest() + { + BulkPoint bdp = new BulkKeyPoint("point-key", 12.34); + var result = JsonSerializationTests.serializer.Serialize(bdp); + + Assert.AreEqual("{\"key\":\"point-key\",\"v\":12.34}", result); + } + } + + [TestFixture] + public class BulkDataSetSerializationTests + { + [Test] + public void SmokeTest() + { + var data = new List + { + new BulkIdPoint("id1", 12.34), + new BulkKeyPoint("mykey", 56.78), + new BulkIdPoint("id2", 90.12) + }; + var bds = new BulkDataSet(new DateTime(2012, 1, 1), data); + var result = JsonSerializationTests.serializer.Serialize(bds); + + Assert.AreEqual("{\"t\":\"2012-01-01T00:00:00.000-08:00\",\"data\":[{\"id\":\"id1\",\"v\":12.34},{\"key\":\"mykey\",\"v\":56.78},{\"id\":\"id2\",\"v\":90.12}]}", result); + } + } } }