public void InteractorReturnsChannelInformationFromRepository() { var informationItemIds = new[] { "BabyOne.de.TutTutGarage", "Cinemaxx.de.movie.BigGreekWedding" }; SetUpSpecified(new GetChannelRepositoryReturnsSpecificResponseStub(new Channel { Id = "all", InformationItemIds = informationItemIds })); var response = interactor.Execute(); var expectedResponse = new GetChannelResponse { ChannelId = "all", InformationItemIds = informationItemIds }; Assert.Equal( JsonConvert.SerializeObject(expectedResponse), JsonConvert.SerializeObject(response) ); }
public void InteractorReturnsEmptyResponseByDefault() { var response = interactor.Execute(); var expectedResponse = new GetChannelResponse(); Assert.Equal( JsonConvert.SerializeObject(expectedResponse), JsonConvert.SerializeObject(response) ); }
public override Task <GetChannelResponse> GetChannel(GetChannelRequest request, ServerCallContext context) { var channel = tracker.GetChannel(request.ChannelId); var response = new GetChannelResponse() { ResponseStatus = ResponseHelpers.CreateOkStatus(), ServerLocation = new ServerLocation() { Uri = channel.Peer.Host, Port = channel.Peer.Port } }; return(Task.FromResult(response)); }
/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { GetChannelResponse response = new GetChannelResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("channel", targetDepth)) { var unmarshaller = ChannelUnmarshaller.Instance; response.Channel = unmarshaller.Unmarshall(context); continue; } } return(response); }