public void ConvertWithInvalidMode()
        {
            var reading = "CPS, invalid, CPM, 42, uSv/hr, 0.03, FOO";

            // Test & Verification
            Assert.That(() => { GeigerValuesConverter.ConvertFromReading(reading); }, Throws.TypeOf <FormatException>());
        }
        public async Task PublishReadingAsync(string reading)
        {
            if (reading is null)
            {
                throw new ArgumentNullException(nameof(reading));
            }

            GeigerValues geigerValue;

            try
            {
                geigerValue = GeigerValuesConverter.ConvertFromReading(reading);
                _geigerValues.Add(geigerValue);
            }
            catch (FormatException e)
            {
                Console.WriteLine($"Cannot convert reading: { e }");
                return;
            }

            if (_lastPublish.AddSeconds(PublishIntervall) <= DateTime.Now)
            {
                _lastPublish = DateTime.Now;
                var json = GeigerValuesConverter.ConvertToJson(_lastPublish, _geigerValues.Select(x => x.Radiation));

                var message = new MqttApplicationMessageBuilder()
                              .WithTopic(MqttTopic)
                              .WithPayload(json)
                              .WithRetainFlag(true)
                              .Build();
                await _client.PublishAsync(message);

                _geigerValues.Clear();
            }
        }
        public void ConvertWithValidString2()
        {
            var reading = "CPS, 42, CPM, 4242, uSv/hr, 100.03, FAST";

            // Test
            var result = GeigerValuesConverter.ConvertFromReading(reading);

            // Verification
            Assert.That(result, Is.Not.Null);
            Assert.That(result.CPS, Is.EqualTo(42));
            Assert.That(result.CPM, Is.EqualTo(4242));
            Assert.That(result.Radiation, Is.EqualTo(100.03));
            Assert.That(result.Mode, Is.EqualTo(ModeEnum.FAST));
        }