Skip to content

Commit

Permalink
Added Bulk* Serialization Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
maddenpj committed Dec 17, 2012
1 parent 19c8d0d commit 04ba65a
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions Client.Tests/JsonSerializationTests.cs
Expand Up @@ -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<BulkPoint>
{
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);
}
}
}
}

0 comments on commit 04ba65a

Please sign in to comment.