public Mock <IKodiService> GetKodiServiceMock(GetSeasonsParams parameters) { var mock = new Mock <IKodiService>(); mock.Setup(s => s.GetSeasons(parameters, "UnitTests")) .Returns(() => MakeFauxRequest <GetSeasonsResponse>("seasons.json")); return(mock); }
public void WhenGettingAllSeasons_ItShouldReturnAListOfSeasons() { var service = new KodiService(); var parameters = new GetSeasonsParams { TvShowId = 1, Properties = new[] { SeasonProperties.ShowTitle, SeasonProperties.SeasonNumber } }; var details = service.GetSeasons(parameters); Assert.IsNotNull(details); Assert.IsNotNull(details.Result); Assert.Greater(details.Result.Seasons.Count, 0); Assert.IsInstanceOf <List <Season> >(details.Result.Seasons); }
public void GivenAJsonString_WhenGettingAllSeasons_ItShouldReturnAListOfSeasons() { var parameters = new GetSeasonsParams { TvShowId = 1, Properties = new [] { SeasonProperties.ShowTitle } }; var mock = GetKodiServiceMock(parameters); var service = mock.Object; var actual = service.GetSeasons(parameters, "UnitTests"); var expected = Seasons.GetList(); Assert.IsInstanceOf <JsonRpcResponse <GetSeasonsResponse> >(actual); Assert.That(actual.Result.Seasons.Count, Is.EqualTo(expected.Seasons.Count)); AssertThatPropertyValuesAreEquals(actual.Result, expected); }
public void WhenGettingAllSeasons_WithALimitOf0And1_ItShouldReturnAListWithOneSeason() { var service = new KodiService(); var parameters = new GetSeasonsParams { TvShowId = 1, Properties = new[] { SeasonProperties.ShowTitle }, Limits = new Limits { Start = 0, End = 1 } }; var details = service.GetSeasons(parameters); Assert.IsNotNull(details); Assert.IsNotNull(details.Result); Assert.That(details.Result.Seasons.Count, Is.EqualTo(1)); Assert.IsInstanceOf <List <Season> >(details.Result.Seasons); }
public JsonRpcResponse <GetSeasonsResponse> GetSeasons(GetSeasonsParams parameters = null, string requestId = "GetSeasonsResponse") { return(_rpcConnector.MakeRequest <GetSeasonsResponse>(KodiMethods.GetSeasons, parameters, requestId)); }