Rails style fixture deserializer for c#

45 views Asked by At

Is there an open source deserializer in C# that could read a RoR style fixture into a given type? I tried googling it, but there really was not much that came up. It seems like a really simple thing that someone else has probably already done.

Example fixture file:

temperature_readings.yml

one:
  CelciusReading: 9.99

two:
  CelciusReading: 23

Library call:

Dictionary<String, TemperatureReading> readings = Fixture.Get<TemperatureReading>("temperature_readings.yml");

Expected output would be something like:

  readings = new []{
      {
       Key = "one",
       Value = new TemperatureReading { CelciusReading = 9.99 }
      },
      {
       Key = "two",
       Value = new TemperatureReading { CelciusReading = 23 }
      }
    };
1

There are 1 answers

0
Simon The Cat On

Turns out there is a library released under the MIT license called YamlSerializer.

https://yamlserializer.codeplex.com/