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); }
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); }
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); }
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); }
public JsonRpcResponse <GetTvShowsResponse> GetTvShows(GetTvShowsParams parameters, string requestId = "GetTvShowsResponse") { return(_rpcConnector.MakeRequest <GetTvShowsResponse>(KodiMethods.GetTvShows, parameters, requestId)); }