public void TestGetCorrectValueAsString() { ApiJsonStarshipsParser parser = new ApiJsonStarshipsParser(jsonStringWithAllDataMonth, mockLogger.Object); string result = parser.GetPropertyAsString("next"); Assert.Equal("next_value", result); }
public void TestParseCorrect() { ApiJsonStarshipsParser parser = new ApiJsonStarshipsParser(jsonStringWithAllDataMonth, mockLogger.Object); List <Starship> result = parser.Parse(); Assert.Equal(2, result.Count); Assert.Equal(730, (int)result[0].Consumables); }
public void TestGetIncorrectValueAsString() { ApiJsonStarshipsParser parser = new ApiJsonStarshipsParser(jsonStringWithoutValue, mockLogger.Object); Assert.Throws <KeyNotFoundException> (() => { string result = parser.GetPropertyAsString("next"); }); }
public void TestParseIncorrect() { ApiJsonStarshipsParser parser = new ApiJsonStarshipsParser(jsonStringWithoutValue, mockLogger.Object); Assert.Throws <AggregateException> (parser.Parse); }