public async Task RequestsTheEmojiEndpoint() { var links = new Dictionary <string, Uri>(); var scopes = new List <string>(); IResponse <Dictionary <string, string> > response = new ApiResponse <Dictionary <string, string> > { ApiInfo = new ApiInfo(links, scopes, scopes, "", new RateLimit(new Dictionary <string, string>())), BodyAsObject = new Dictionary <string, string> { { "foo", "http://example.com/foo.gif" }, { "bar", "http://example.com/bar.gif" } } }; var connection = Substitute.For <IConnection>(); connection.GetAsync <Dictionary <string, string> >(Args.Uri, null, null).Returns(Task.FromResult(response)); var client = new MiscellaneousClient(connection); var emojis = await client.GetEmojis(); Assert.Equal(2, emojis.Count); Assert.Equal("foo", emojis[0].Name); connection.Received() .GetAsync <Dictionary <string, string> >(Arg.Is <Uri>(u => u.ToString() == "emojis"), null, null); }
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.GetEmojis(); 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); }
public async Task RequestsTheEmojiEndpoint() { var links = new Dictionary<string, Uri>(); var scopes = new List<string>(); IResponse<Dictionary<string, string>> response = new ApiResponse<Dictionary<string, string>> { ApiInfo = new ApiInfo(links, scopes, scopes, "", new RateLimit(new Dictionary<string, string>())), BodyAsObject = new Dictionary<string, string> { { "foo", "http://example.com/foo.gif" }, { "bar", "http://example.com/bar.gif" } } }; var connection = Substitute.For<IConnection>(); connection.GetAsync<Dictionary<string, string>>(Args.Uri, null, null).Returns(Task.FromResult(response)); var client = new MiscellaneousClient(connection); var emojis = await client.GetEmojis(); Assert.Equal(2, emojis.Count); connection.Received() .GetAsync<Dictionary<string, string>>(Arg.Is<Uri>(u => u.ToString() == "emojis"), null, null); }
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.GetEmojis(); 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); }