Ejemplo n.º 1
0
        public async Task FindBySessionIdAsync_sends_ok()
        {
            var handler = new Mock <HttpMessageHandler>();

            handler.Protected()
            .Setup <Task <HttpResponseMessage> >(
                "SendAsync",
                ItExpr.IsAny <HttpRequestMessage>(),
                ItExpr.IsAny <CancellationToken>())
            .ReturnsAsync(new HttpResponseMessage
            {
                StatusCode = HttpStatusCode.OK,
                Content    = new StringContent(string.Empty)
            });

            var httpClient = new HttpClient(handler.Object)
            {
                BaseAddress = this.baseAddress
            };

            var client = new SummaryClient(httpClient);

            await client.FindBySessionIdAsync(42);

            handler.Protected().Verify(
                "SendAsync",
                Times.Once(),
                ItExpr.Is <HttpRequestMessage>(req =>
                                               req.Method == HttpMethod.Get &&
                                               req.RequestUri == new Uri("https://localhost:5001/api/summary/42")),
                ItExpr.IsAny <CancellationToken>());
        }
Ejemplo n.º 2
0
        public void Summary_0通常データ()
        {
            var ret = SummaryClient.ParseSummaryData(TestHelper.Load(@"Dictionaries/Summary/default.json"));

            Assert.AreEqual("sm9", ret.Title);
            Assert.AreEqual("sm9", ret.ViewTitle);
            Assert.AreEqual("概要\n1000万再生達成\n 400万コメント達成\n β時代の英雄\n ニコニコ動画に現存するSMILEVIDEOの最古の動画で、ニコニコ動画を代表する動画。公式動画第一号である。レッツゴー!陰陽師、陰陽", ret.Summary);
        }
Ejemplo n.º 3
0
        public void Summary_1エラーデータ()
        {
            var ret = SummaryClient.ParseSummaryData(TestHelper.Load(@"Dictionaries/Summary/null.json"));

            Assert.IsNull(ret);
        }