Beispiel #1
0
        public void At_least_one_field_is_required_for_multiple_values()
        {
            var    fields = new List <string>();
            var    values = new List <object>();
            Action action = () =>
            {
                var unused = new LineProtocolPointMultipleValues("measurement", fields, values, MetricTags.Empty);
            };

            action.Should().Throw <ArgumentException>();
        }
Beispiel #2
0
        public void Field_key_cannot_be_empty_for_multiple_values()
        {
            var    fieldsNames  = new[] { string.Empty };
            var    fieldsValues = new object[] { "values" };
            Action action       = () =>
            {
                var unused = new LineProtocolPointMultipleValues("measurement", fieldsNames, fieldsValues, MetricTags.Empty);
            };

            action.Should().Throw <ArgumentException>();
        }
Beispiel #3
0
        public void Can_format_payload_with_multiple_fields_correctly()
        {
            var textWriter   = new StringWriter();
            var fieldsNames  = new[] { "field1key", "field2key", "field3key" };
            var fieldsValues = new object[] { "field1value", 2, false };
            var timestamp    = new DateTime(2017, 1, 1, 1, 1, 1, DateTimeKind.Utc);
            var point        = new LineProtocolPointMultipleValues("measurement", fieldsNames, fieldsValues, MetricTags.Empty, timestamp);

            point.Write(textWriter);

            textWriter.ToString().Should().Be("measurement field1key=\"field1value\",field2key=2i,field3key=f 1483232461000000000");
        }