Esempio n. 1
0
 ReadOnlySpan <char> FromJson(InstantAnswer instantAnswer, string json, bool utf8)
 {
     if (utf8)
     {
         return(Encoding.UTF8.GetString(_converter.FromJson(instantAnswer, Encoding.UTF8.GetBytes(json))));
     }
     return(_converter.FromJson(instantAnswer, json));
 }
Esempio n. 2
0
        public void FromJson_CorectProperties(bool utf8)
        {
            // arrange
            InstantAnswer instantAnswer = new InstantAnswer();
            var           json          = File.ReadAllText(Path.Combine("DuckDuckGo", "DuckDuckGo.json"));

            // act
            FromJson(instantAnswer, json, utf8);

            // assert
            Assert.That(instantAnswer.Abstract, Is.EqualTo(_expectedText));
            Assert.That(instantAnswer.AbstractText, Is.EqualTo(_expectedText));
            Assert.That(instantAnswer.Image, Is.EqualTo("/i/2523dee7.png"));
            Assert.That(instantAnswer.ImageHeight, Is.EqualTo(200));
            Assert.That(instantAnswer.ImageWidth, Is.EqualTo(400));
        }