public void ReadFromJson_ArgumentNullException_Test() { string json = null; var textReader = new Mock <TextReader>(); textReader.Setup(tr => tr.ReadToEnd()).Returns(json); var JsonFileReader = new JsonFileReader(textReader.Object); Assert.Throws <ArgumentNullException>(() => JsonFileReader.ReadFromJson()); }
public void ReadFromJson_NormalConditions_Test() { string json = JsonConvert.SerializeObject(_testArray); var textReader = new Mock <TextReader>(); textReader.Setup(tr => tr.ReadToEnd()).Returns(json); var JsonFileReader = new JsonFileReader(textReader.Object); var actualCollection = JsonFileReader.ReadFromJson(); CollectionAssert.AreEqual(actualCollection, _testArray); }