コード例 #1
0
        public void WriteJsonShouldConvert()
        {
            TimeseriesPeriodConverter target = new TimeseriesPeriodConverter(); // TODO: Initialize to an appropriate value
            using(var ms = new MemoryStream()) {
                var tw = new StreamWriter(ms);

                JsonWriter writer = new JsonTextWriter(tw); // TODO: Initialize to an appropriate value
                JsonSerializer serializer = new JsonSerializer(); // TODO: Initialize to an appropriate value

                target.WriteJson(writer, new TimeseriesPeriod(1, 2, 3), serializer);
                writer.Flush();

                ms.Position = 0;
                var result = new StreamReader(ms).ReadToEnd();
                Assert.AreEqual("{\"Count\":6,\"QuestionCount\":1,\"AnswerCount\":2,\"CommentCount\":3}", result);
            }
        }
コード例 #2
0
 public void WriteJsonShouldThrowExceptionOnNotTimeseriesResult()
 {
     TimeseriesPeriodConverter target = new TimeseriesPeriodConverter(); // TODO: Initialize to an appropriate value
     target.WriteJson(null, new object(), null);
 }