private FilteredEpisodeInfoWrapper ProcessRequest(EpisodeInfoWrapper request) { var response = request.Payload.Where(x => (x.Drm && x.EpisodeCount > 0)) .Select(c => new FilteredEpisodeInfo { Image = c.Image?.ShowImage, Slug = c.Slug, Title = c.Title }); return new FilteredEpisodeInfoWrapper { Response= response.ToArray() }; }
public void PostShouldReturnItemsifCriteriaMatched() { EpisodeInfoWrapper request = new EpisodeInfoWrapper { Payload = new[] {new EpisodeInfo { Drm = true, EpisodeCount = 2 }} }; CheckResponseForOneOrMoreRecords(request); }
public void GetShouldReturnZeroItemsifCriteriaNotMatched() { EpisodeInfoWrapper req = new EpisodeInfoWrapper { Payload = new[] {new EpisodeInfo { Drm = true, EpisodeCount = 0 }} }; CheckResponseForZeroRecords(req); }
private bool ValidateRequest(EpisodeInfoWrapper request) { if (request?.Payload == null) { return false; } return true; }
public void PostShouldReturnBadRequestonInvalidInput() { EpisodeInfoWrapper req = new EpisodeInfoWrapper(); var response = _episodeController.Post(req); response.StatusCode.Should().Be(HttpStatusCode.BadRequest); }
private void CheckResponseForZeroRecords(EpisodeInfoWrapper req) { var response = _episodeController.Post(req); response.StatusCode.Should().Be(HttpStatusCode.OK); FilteredEpisodeInfoWrapper jsonResponse; HttpResponseMessageExtensions.TryGetContentValue(response, out jsonResponse).Should().BeTrue(); jsonResponse.Response.Length.Should().Be(0); }