Example #1
0
        public void ApiTest()
        {
            var service = new TestTinami(@"^http://www\.tinami\.com/view/(?<ContentId>\d+)$",
                "http://api.tinami.com/content/info?cont_id=${ContentId}&api_key=" + ApplicationSettings.TINAMIApiKey);

            service.FakeXml = @"<?xml version='1.0' encoding='utf-8' ?>
            <rsp stat='ok'>
              <content type='illust' issupport='1' iscollection='0'>
            <title>ほげほげ</title>
            <description>説明</description>
            <thumbnails>
              <thumbnail_150x150 url='http://img.tinami.com/hogehoge_150.gif' width='112' height='120'/>
            </thumbnails>
            <image>
              <url>http://img.tinami.com/hogehoge_full.gif</url>
              <width>640</width>
              <height>480</height>
            </image>
              </content>
            </rsp>";
            var thumbinfo = service.GetThumbnailInfo("http://www.tinami.com/view/12345", null);

            Assert.That(thumbinfo, Is.Not.Null);
            Assert.That(thumbinfo.ImageUrl, Is.EqualTo("http://www.tinami.com/view/12345"));
            Assert.That(thumbinfo.ThumbnailUrl, Is.EqualTo("http://img.tinami.com/hogehoge_150.gif"));
            Assert.That(thumbinfo.TooltipText, Is.EqualTo("説明"));
        }
Example #2
0
        public async Task ApiTest()
        {
            var service = new TestTinami();

            service.FakeXml = @"<?xml version='1.0' encoding='utf-8' ?>
<rsp stat='ok'>
  <content type='illust' issupport='1' iscollection='0'>
    <title>ほげほげ</title>
    <description>説明</description>
    <thumbnails>
      <thumbnail_150x150 url='http://img.tinami.com/hogehoge_150.gif' width='112' height='120'/>
    </thumbnails>
    <image>
      <url>http://img.tinami.com/hogehoge_full.gif</url>
      <width>640</width>
      <height>480</height>
    </image>
  </content>
</rsp>";
            var thumbinfo = await service.GetThumbnailInfoAsync("http://www.tinami.com/view/12345", null, CancellationToken.None);

            Assert.NotNull(thumbinfo);
            Assert.Equal("http://www.tinami.com/view/12345", thumbinfo.MediaPageUrl);
            Assert.Equal("http://img.tinami.com/hogehoge_150.gif", thumbinfo.ThumbnailImageUrl);
            Assert.Equal("説明", thumbinfo.TooltipText);
        }
Example #3
0
        public async Task ApiTest()
        {
            var service = new TestTinami();

            service.FakeXml = @"<?xml version='1.0' encoding='utf-8' ?>
<rsp stat='ok'>
  <content type='illust' issupport='1' iscollection='0'>
    <title>ほげほげ</title>
    <description>説明</description>
    <thumbnails>
      <thumbnail_150x150 url='http://img.tinami.com/hogehoge_150.gif' width='112' height='120'/>
    </thumbnails>
    <image>
      <url>http://img.tinami.com/hogehoge_full.gif</url>
      <width>640</width>
      <height>480</height>
    </image>
  </content>
</rsp>";
            var thumbinfo = await service.GetThumbnailInfoAsync("http://www.tinami.com/view/12345", null, CancellationToken.None);

            Assert.NotNull(thumbinfo);
            Assert.Equal("http://www.tinami.com/view/12345", thumbinfo.ImageUrl);
            Assert.Equal("http://img.tinami.com/hogehoge_150.gif", thumbinfo.ThumbnailUrl);
            Assert.Equal("説明", thumbinfo.TooltipText);
        }
        public void ApiTest()
        {
            var service = new TestTinami(@"^http://www\.tinami\.com/view/(?<ContentId>\d+)$",
                                         "http://api.tinami.com/content/info?cont_id=${ContentId}&api_key=" + ApplicationSettings.TINAMIApiKey);

            service.FakeXml = @"<?xml version='1.0' encoding='utf-8' ?>
<rsp stat='ok'>
  <content type='illust' issupport='1' iscollection='0'>
    <title>ほげほげ</title>
    <description>説明</description>
    <thumbnails>
      <thumbnail_150x150 url='http://img.tinami.com/hogehoge_150.gif' width='112' height='120'/>
    </thumbnails>
    <image>
      <url>http://img.tinami.com/hogehoge_full.gif</url>
      <width>640</width>
      <height>480</height>
    </image>
  </content>
</rsp>";
            var thumbinfo = service.GetThumbnailInfo("http://www.tinami.com/view/12345", null);

            Assert.That(thumbinfo, Is.Not.Null);
            Assert.That(thumbinfo.ImageUrl, Is.EqualTo("http://www.tinami.com/view/12345"));
            Assert.That(thumbinfo.ThumbnailUrl, Is.EqualTo("http://img.tinami.com/hogehoge_150.gif"));
            Assert.That(thumbinfo.TooltipText, Is.EqualTo("説明"));
        }
Example #5
0
        public async Task ApiErrorTest()
        {
            var service = new TestTinami();

            service.FakeXml = @"<?xml version='1.0' encoding='utf-8'?>
<rsp stat='user_only'>
  <err msg='この作品は登録ユーザー限定の作品です。'/>
</rsp>";
            var thumbinfo = await service.GetThumbnailInfoAsync("http://www.tinami.com/view/12345", null, CancellationToken.None);

            Assert.Null(thumbinfo);
        }
Example #6
0
        public async Task ApiErrorTest()
        {
            var service = new TestTinami();

            service.FakeXml = @"<?xml version='1.0' encoding='utf-8'?>
<rsp stat='user_only'>
  <err msg='この作品は登録ユーザー限定の作品です。'/>
</rsp>";
            var thumbinfo = await service.GetThumbnailInfoAsync("http://www.tinami.com/view/12345", null, CancellationToken.None);

            Assert.Null(thumbinfo);
        }
Example #7
0
        public void ApiErrorTest()
        {
            var service = new TestTinami(@"^http://www\.tinami\.com/view/(?<ContentId>\d+)$",
                "http://api.tinami.com/content/info?cont_id=${ContentId}&api_key=" + ApplicationSettings.TINAMIApiKey);

            service.FakeXml = @"<?xml version='1.0' encoding='utf-8'?>
            <rsp stat='user_only'>
              <err msg='この作品は登録ユーザー限定の作品です。'/>
            </rsp>";
            var thumbinfo = service.GetThumbnailInfo("http://www.tinami.com/view/12345", null);

            Assert.That(thumbinfo, Is.Null);
        }
        public void ApiErrorTest()
        {
            var service = new TestTinami(@"^http://www\.tinami\.com/view/(?<ContentId>\d+)$",
                                         "http://api.tinami.com/content/info?cont_id=${ContentId}&api_key=" + ApplicationSettings.TINAMIApiKey);

            service.FakeXml = @"<?xml version='1.0' encoding='utf-8'?>
<rsp stat='user_only'>
  <err msg='この作品は登録ユーザー限定の作品です。'/>
</rsp>";
            var thumbinfo = service.GetThumbnailInfo("http://www.tinami.com/view/12345", null);

            Assert.That(thumbinfo, Is.Null);
        }