コード例 #1
0
        public Mock <IKodiService> GetKodiServiceMock(GetTvShowsParams parameters)
        {
            var mock = new Mock <IKodiService>();

            mock.Setup(s => s.GetTvShows(parameters, "UnitTests"))
            .Returns(() => MakeFauxRequest <GetTvShowsResponse>("tvshows.json"));

            return(mock);
        }
コード例 #2
0
        public void GivenAJsonString_WhenGettingAllTvShows_ItShouldReturnAListOfShows()
        {
            var parameters = new GetTvShowsParams
            {
                Properties = new [] { TvShowProperties.Title }
            };

            var mock     = GetKodiServiceMock(parameters);
            var service  = mock.Object;
            var actual   = service.GetTvShows(parameters, "UnitTests");
            var expected = TvShows.GetList();

            Assert.IsInstanceOf <JsonRpcResponse <GetTvShowsResponse> >(actual);
            Assert.That(actual.Result.TvShows.Count, Is.EqualTo(expected.TvShows.Count));
            AssertThatPropertyValuesAreEquals(actual.Result, expected);
        }
コード例 #3
0
        public void WhenGettingAllTvShows_ItShouldReturnAListOfTvShows()
        {
            var service = new KodiService();

            var parameters = new GetTvShowsParams
            {
                Properties = new[] { TvShowProperties.Title, TvShowProperties.Year }
            };

            var details = service.GetTvShows(parameters);

            Assert.IsNotNull(details);
            Assert.IsNotNull(details.Result);
            Assert.Greater(details.Result.TvShows.Count, 0);
            Assert.IsInstanceOf <List <TvShow> >(details.Result.TvShows);
        }
コード例 #4
0
        public void WhenGettingAllTvShows_WithALimitOf0And1_ItShouldReturnAListWithOneTvShow()
        {
            var service = new KodiService();

            var parameters = new GetTvShowsParams
            {
                Properties = new[] { TvShowProperties.Title },
                Limits     = new Limits
                {
                    Start = 0,
                    End   = 1
                }
            };

            var details = service.GetTvShows(parameters);

            Assert.IsNotNull(details);
            Assert.IsNotNull(details.Result);
            Assert.That(details.Result.TvShows.Count, Is.EqualTo(1));
            Assert.IsInstanceOf <List <TvShow> >(details.Result.TvShows);
        }
コード例 #5
0
ファイル: KodiService.cs プロジェクト: fraserb99/KodiRPC
 public JsonRpcResponse <GetTvShowsResponse> GetTvShows(GetTvShowsParams parameters, string requestId = "GetTvShowsResponse")
 {
     return(_rpcConnector.MakeRequest <GetTvShowsResponse>(KodiMethods.GetTvShows, parameters, requestId));
 }