I have a json file in my project that I want to test deserializes correctly. I want to use embedded resources to do this. However I can't work out the correct way to get the json file (which is in the same folder as my test file for now). So far I have tried the following:
[Test]
public void JsonDeserializesTest()
{
var reader = new EmbeddedResourceReader(typeof(RatingComponentTests).Assembly, "Components\\UserFeedback");
var json = reader.ReadToEnd("Rating.json");
var jsonData = JsonConvert.DeserializeObject<RatingData>(json);
Assert.IsNotNull(jsonData.results);
}
This isn't working with 'ReadToEnd' not being a valid method. I have tried 'ReadAsStream' but this throws the error that I cannot convert a stream to a string.
Can anyone please point me in the right direction? Thanks