Represents a datapoint for a series referenced by id. This class is used to represent datapoints in a multi write.
Inheritance: MultiPoint
Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        public void Double_Or_Long()
        {
            var dp1 = new MultiIdPoint("id1", new DateTime(2013, 9, 25, 0, 0, 1), 12.34);
              var dp2 = new MultiIdPoint("id2", new DateTime(2013, 9, 25, 0, 0, 1), 1000L);

              Assert.AreEqual(dp1.Value, 12.34);
              Assert.AreEqual(dp1.Value is double, true);
              Assert.AreEqual(dp2.Value, 1000L);
              Assert.AreEqual(dp2.Value is long, true);
        }
Ejemplo n.º 3
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/")));
        }
Ejemplo n.º 4
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)));
        }
Ejemplo n.º 5
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"))));
        }
Ejemplo n.º 6
0
            public void MultiIdPoint()
            {
                var dp1 = new MultiIdPoint("id1", new DateTime(2012, 1, 1), 12.34);
                  var result = JsonSerializationTests.serializer.Serialize(dp1);

                  Assert.AreEqual("{\"id\":\"id1\",\"t\":\"2012-01-01T00:00:00.000-06:00\",\"v\":12.34}", result);
            }
Ejemplo n.º 7
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);
            }