public async Task RequestsCorrectValueForStatusCode(HttpStatusCode status, bool expected) { var response = Task.Factory.StartNew <IResponse <object> >(() => new ApiResponse <object> { StatusCode = status }); var connection = Substitute.For <IConnection>(); connection.GetAsync <object>(Arg.Is <Uri>(u => u.ToString() == "gists/1/star"), null, null).Returns(response); var apiConnection = Substitute.For <IApiConnection>(); apiConnection.Connection.Returns(connection); var client = new GistsClient(apiConnection); var result = await client.IsStarred("1"); Assert.Equal(expected, result); }