Skip to content

Commit

Permalink
added test for coordinates
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith committed Aug 11, 2013
1 parent b9f0a5b commit b02ba75
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
3 changes: 3 additions & 0 deletions YelpSharp/Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ public class Options

}
}



8 changes: 4 additions & 4 deletions YelpSharpTests/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ public static Options Options
// doing the env dance, if you so choose
_options = new Options()
{
AccessToken = Environment.GetEnvironmentVariable("YELP_ACCESS_TOKEN", EnvironmentVariableTarget.Machine),
AccessTokenSecret = Environment.GetEnvironmentVariable("YELP_ACCESS_TOKEN_SECRET", EnvironmentVariableTarget.Machine),
ConsumerKey = Environment.GetEnvironmentVariable("YELP_CONSUMER_KEY", EnvironmentVariableTarget.Machine),
ConsumerSecret = Environment.GetEnvironmentVariable("YELP_CONSUMER_SECRET", EnvironmentVariableTarget.Machine)
AccessToken = Environment.GetEnvironmentVariable("YELP_ACCESS_TOKEN", EnvironmentVariableTarget.User),
AccessTokenSecret = Environment.GetEnvironmentVariable("YELP_ACCESS_TOKEN_SECRET", EnvironmentVariableTarget.User),
ConsumerKey = Environment.GetEnvironmentVariable("YELP_CONSUMER_KEY", EnvironmentVariableTarget.User),
ConsumerSecret = Environment.GetEnvironmentVariable("YELP_CONSUMER_SECRET", EnvironmentVariableTarget.User)
};

if (String.IsNullOrEmpty(_options.AccessToken) ||
Expand Down
21 changes: 20 additions & 1 deletion YelpSharpTests/YelpTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,27 @@ public void MultipleCategories()
}
#endregion

#region ErrorTests
#region VerifyLocationInResult
/// <summary>
/// search for a business, and ensure the lat & long are available
/// </summary>
[TestMethod]
public void VerifyLocationInResult()
{
var y = new Yelp(Config.Options);
var results = y.Search("coffee", "seattle, wa").Result;
if (results.error != null)
{
Assert.Fail(results.error.text);
}
var bus = results.businesses[0];
if (bus.location.coordinate == null)
Assert.Fail("No coordinate found on location for business");

}
#endregion

#region ErrorTests
/// <summary>
/// Verify UNAVAILABLE_FOR_LOCATION is returned in error.id
/// </summary>
Expand Down

0 comments on commit b02ba75

Please sign in to comment.