public void Multi_List() { var dp1 = new MultiIdPoint("id1", new DateTime(2013, 9, 25, 0, 0, 1), 12.24); var dp2 = new MultiKeyPoint("key1", new DateTime(2013, 9, 25, 0, 0, 1), 1000L); var list = new List<MultiPoint>{ dp1, dp2 }; Assert.AreEqual(list.Count, 2); }
public void RequestUrl() { var mockclient = TestCommon.GetMockRestClient(); var client = TestCommon.GetClient(mockclient.Object); var dp1 = new MultiIdPoint("id1", new DateTime(2013, 9, 25, 0, 0, 1), 12.24); var dp2 = new MultiKeyPoint("key1", new DateTime(2013, 9, 25, 0, 0, 1), 1000L); var list = new List<MultiPoint>{ dp1, dp2 }; client.WriteMultiData(list); mockclient.Verify(cl => cl.Execute(It.Is<RestRequest>(req => req.Resource == "/multi/"))); }
public void RequestMethod() { var mockclient = TestCommon.GetMockRestClient(); var client = TestCommon.GetClient(mockclient.Object); var dp1 = new MultiIdPoint("id1", new DateTime(2013, 9, 25, 0, 0, 1), 12.24); var dp2 = new MultiKeyPoint("key1", new DateTime(2013, 9, 25, 0, 0, 1), 1000L); var list = new List<MultiPoint>{ dp1, dp2 }; client.WriteMultiData(list); Expression<Func<RestRequest, bool>> assertion = req => req.Method == Method.POST; mockclient.Verify(cl => cl.Execute(It.Is<RestRequest>(assertion))); }
public void IncludesPoints() { var mockclient = TestCommon.GetMockRestClient(); var client = TestCommon.GetClient(mockclient.Object); var dp1 = new MultiIdPoint("id1", new DateTime(2013, 9, 25, 0, 0, 1), 12.24); var dp2 = new MultiKeyPoint("key1", new DateTime(2013, 9, 25, 0, 0, 1), 1000L); var list = new List<MultiPoint>{ dp1, dp2 }; client.WriteMultiData(list); mockclient.Verify(cl => cl.Execute(It.Is<RestRequest>(req => TestCommon.ContainsParameterByPattern(req.Parameters, "application/json", "12.24")))); mockclient.Verify(cl => cl.Execute(It.Is<RestRequest>(req => TestCommon.ContainsParameterByPattern(req.Parameters, "application/json", "1000")))); }
public void MultiKeyPoint() { var dp1 = new MultiKeyPoint("key1", new DateTime(2012, 1, 1), 1200L); var result = JsonSerializationTests.serializer.Serialize(dp1); Assert.AreEqual("{\"key\":\"key1\",\"t\":\"2012-01-01T00:00:00.000-06:00\",\"v\":1200}", result); }
public void MultiDataSet() { var dp1 = new MultiKeyPoint("key1", new DateTime(2012, 1, 1), 1200L); var dp2 = new MultiIdPoint("id1", new DateTime(2012, 1, 2), 12.34); var data = new List<MultiPoint> { dp1, dp2 }; var result = JsonSerializationTests.serializer.Serialize(data); Assert.AreEqual("[{\"key\":\"key1\",\"t\":\"2012-01-01T00:00:00.000-06:00\",\"v\":1200},{\"id\":\"id1\",\"t\":\"2012-01-02T00:00:00.000-06:00\",\"v\":12.34}]", result); }