public void ReadJsonSerializeAllOk() { var movies = EmbeddedFileUtility.ReadJson <IEnumerable <Movie> >("Files.Movies.json"); Assert.AreEqual(1, movies.ElementAt(0).Id); Assert.AreEqual(2, movies.ElementAt(1).Id); Assert.AreEqual(3, movies.ElementAt(2).Id); Assert.AreEqual("Enter the Dragon", movies.ElementAt(0).Name); Assert.AreEqual("Kill Bill", movies.ElementAt(1).Name); Assert.AreEqual("Terminator 2", movies.ElementAt(2).Name); }
public void ReadJsonSpecifiedAssembly() { var movies = EmbeddedFileUtility.ReadJson <IEnumerable <Movie> >( "Files.Movies.json", typeof(EmbeddedFileUtilityTest).Assembly); Assert.AreEqual(1, movies.ElementAt(0).Id); Assert.AreEqual(2, movies.ElementAt(1).Id); Assert.AreEqual(3, movies.ElementAt(2).Id); Assert.AreEqual("Enter the Dragon", movies.ElementAt(0).Name); Assert.AreEqual("Kill Bill", movies.ElementAt(1).Name); Assert.AreEqual("Terminator 2", movies.ElementAt(2).Name); }
public void ReadJsonApplyJsonIgnoreOk() { var movies = EmbeddedFileUtility.ReadJson <IEnumerable <Movie> >( "Files.Movies.json", serializeAll: false ); Assert.AreEqual(1, movies.ElementAt(0).Id); Assert.AreEqual(2, movies.ElementAt(1).Id); Assert.AreEqual(3, movies.ElementAt(2).Id); Assert.AreEqual(null, movies.ElementAt(0).Name); Assert.AreEqual(null, movies.ElementAt(1).Name); Assert.AreEqual(null, movies.ElementAt(2).Name); }
public void ReadJsonFileLoadException() { EmbeddedFileUtility.ReadJson <EmbeddedFileUtilityTest>("Files.Movies.json"); }
public void ReadJsonFileNotFoundException() { EmbeddedFileUtility.ReadJson <object>("Files.UnexistingFile.json"); }