public async Task RequestsTheEmojiEndpoint()
            {
                IApiResponse<Dictionary<string, string>> response = new ApiResponse<Dictionary<string, string>>
                (
                    new Response(),
                    new Dictionary<string, string>
                    {
                        { "foo", "http://example.com/foo.gif" },
                        { "bar", "http://example.com/bar.gif" }
                    }
                );
                var connection = Substitute.For<IConnection>();
                connection.Get<Dictionary<string, string>>(Args.Uri, null, null).Returns(Task.FromResult(response));
                var client = new MiscellaneousClient(connection);

                var emojis = await client.GetAllEmojis();

                Assert.Equal(2, emojis.Count);
                Assert.Equal("foo", emojis[0].Name);
                connection.Received()
                    .Get<Dictionary<string, string>>(Arg.Is<Uri>(u => u.ToString() == "emojis"), null, null);
            }
Ejemplo n.º 2
0
            public async Task RequestsTheEmojiEndpoint()
            {
                IReadOnlyList <Emoji> response = new List <Emoji>
                {
                    { new Emoji("foo", "http://example.com/foo.gif") },
                    { new Emoji("bar", "http://example.com/bar.gif") }
                };

                var apiConnection = Substitute.For <IApiConnection>();

                apiConnection.GetAll <Emoji>(Args.Uri)
                .Returns(Task.FromResult(response));

                var client = new MiscellaneousClient(apiConnection);

                var emojis = await client.GetAllEmojis();

                Assert.Equal(2, emojis.Count);
                Assert.Equal("foo", emojis[0].Name);
                apiConnection.Received()
                .GetAll <Emoji>(Arg.Is <Uri>(u => u.ToString() == "emojis"));
            }
Ejemplo n.º 3
0
            public async Task RequestsTheEmojiEndpoint()
            {
                IApiResponse <Dictionary <string, string> > response = new ApiResponse <Dictionary <string, string> >
                                                                       (
                    new Response(),
                    new Dictionary <string, string>
                {
                    { "foo", "http://example.com/foo.gif" },
                    { "bar", "http://example.com/bar.gif" }
                }
                                                                       );
                var connection = Substitute.For <IConnection>();

                connection.Get <Dictionary <string, string> >(Args.Uri, null, null).Returns(Task.FromResult(response));
                var client = new MiscellaneousClient(connection);

                var emojis = await client.GetAllEmojis();

                Assert.Equal(2, emojis.Count);
                Assert.Equal("foo", emojis[0].Name);
                connection.Received()
                .Get <Dictionary <string, string> >(Arg.Is <Uri>(u => u.ToString() == "emojis"), null, null);
            }