public void CanParse() { var calculator = new MathNetCalculator(); var factory = new SensorFactory(calculator); factory.RegisterSensor("thermometer", (n, refs, calc) => new ThermometerSensor(n, refs["temperature"], calc)); factory.RegisterSensor("humidity", (n, refs, calc) => new HumiditySensor(n, (decimal)refs["humidity"])); factory.RegisterSensor("monoxide", (n, refs, calc) => new MonoxideSensor(n, (int)refs["ppm"])); var parser = new SpanSensorLogParser(factory); var content = GetInputData(); var sensors = parser.Parse(content)?.ToDictionary(k => k.Name, v => v.GetStatus()); Console.WriteLine(JsonSerializer.Serialize(sensors, new JsonSerializerOptions { WriteIndented = true })); }