示例#1
0
        public void TestGetCorrectValueAsString()
        {
            ApiJsonStarshipsParser parser = new ApiJsonStarshipsParser(jsonStringWithAllDataMonth, mockLogger.Object);
            string result = parser.GetPropertyAsString("next");

            Assert.Equal("next_value", result);
        }
示例#2
0
        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);
        }
示例#3
0
        public void TestGetIncorrectValueAsString()
        {
            ApiJsonStarshipsParser parser = new ApiJsonStarshipsParser(jsonStringWithoutValue, mockLogger.Object);

            Assert.Throws <KeyNotFoundException> (() => {
                string result = parser.GetPropertyAsString("next");
            });
        }
示例#4
0
        public void TestParseIncorrect()
        {
            ApiJsonStarshipsParser parser = new ApiJsonStarshipsParser(jsonStringWithoutValue, mockLogger.Object);

            Assert.Throws <AggregateException> (parser.Parse);
        }