public void Cleanup() { this.testJsonConnector = null; if (File.Exists(this.testJsonFileName)) { File.Delete(this.testJsonFileName); } }
public void TestMethodListOfArtistsFailedDueToFileErrorContaint() { //given this.strWriter = new StreamWriter(this.testJsonFileName); strWriter.Write("This is not json content"); strWriter.Close(); this.testJsonConnector = new JsonConnector(this.testJsonFileName); //then this.listOfArtists = this.testJsonConnector.ListOfArtists(); //when Assert.IsNull(this.listOfArtists); }
public void TestMethodListOfArtistsSucessAmountOfArtistsObject() { int expectedAmountOfArtists = 2; int actualAmountOfArtists = -1; //given this.strWriter = new StreamWriter(this.testJsonFileName); strWriter.Write("[{\"pictureName\":\"Pic1.png\",\"name\":\"Artiste1\",\"listOfSongs\":[{\"title\":\"SongA1\",\"duration\":1},{\"title\":\"SongA2\",\"duration\":2}]},{\"pictureName\":\"Pic2.png\",\"name\":\"Artiste1\",\"listOfSongs\":[{\"title\":\"SongB1\",\"duration\":3},{\"title\":\"SongB2\",\"duration\":4}]}]"); strWriter.Close(); this.testJsonConnector = new JsonConnector(this.testJsonFileName); //then this.listOfArtists = this.testJsonConnector.ListOfArtists(); actualAmountOfArtists = this.listOfArtists.Count; //when Assert.AreEqual(expectedAmountOfArtists, actualAmountOfArtists); }