Represents a datapoint for a series referenced by key. This class is used to represent datapoints in a multi write.
Наследование: MultiPoint
Пример #1
0
        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);
        }
Пример #2
0
        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/")));
        }
Пример #3
0
        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)));
        }
Пример #4
0
        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"))));
        }
Пример #5
0
            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);
            }
Пример #6
0
            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);
            }