Пример #1
0
        public async System.Threading.Tasks.Task TestGetRandomStreamMustHaveOneStream()
        {
            _fakeHttpMessageHandler.Setup(f => f.Send(It.IsAny <HttpRequestMessage>())).Returns(new HttpResponseMessage
            {
                StatusCode = HttpStatusCode.OK,
                Content    = new StringContent
                                 (File.ReadAllText("streams.json"))
            });

            var api = new TwitchApi("1234", _twitchClient);

            var result = await api.GetRandomStream();

            _outputter.WriteLine($"Stream title: {result.title}");
            _outputter.WriteLine($"Stream username: {result.user_name}");

            Assert.IsType <StreamDTO>(result);
        }
Пример #2
0
        public async Task <StreamDTO> RandomStream()
        {
            var twitchApi = new TwitchApi(_apikeys.twitch);

            return(await twitchApi.GetRandomStream());
        }