public void BeginUpdate_WithInReplyToIdSet_PopulatesParameter() { // act const string inReplyToId = "12345"; var twitterClient = Substitute.For<IBaseTwitterClient>(); twitterClient.When(a => a.BeginRequest(Arg.Any<string>(), Arg.Any<IDictionary<string, string>>(), Arg.Any<WebMethod>(), Arg.Any<RestCallback>())) .Do(c => c.AssertParameter("in_reply_to_status_id", inReplyToId)); var statuses = new Statuses(twitterClient); // assert GenericResponseDelegate endBeginUpdate = (a, b, c) => { }; // act statuses.BeginUpdate("some words go here", "12345", endBeginUpdate); }
public void BeginUpdate_WithLocationSet_PopulatesParameters() { // act const double latitute = 10.0; const double longitude = 15.0; var twitterClient = Substitute.For<IBaseTwitterClient>(); twitterClient.When(a => a.BeginRequest(Arg.Any<string>(), Arg.Any<IDictionary<string, string>>(), Arg.Any<WebMethod>(), Arg.Any<RestCallback>())) .Do(c => { c.AssertParameter("lat", latitute); c.AssertParameter("long", longitude); }); var statuses = new Statuses(twitterClient); // assert GenericResponseDelegate endBeginUpdate = (a, b, c) => { }; // act statuses.BeginUpdate("some words go here", "12345", latitute, longitude, endBeginUpdate); }
public void BeginUpdate_WithTextOnly_ReturnsValidResult() { // act var wasCalled = false; var twitterClient = Substitute.For<IBaseTwitterClient>(); twitterClient.SetResponse(File.ReadAllText(@".\Data\statuses\update-plain.json")); var statuses = new Statuses(twitterClient); // assert GenericResponseDelegate endBeginUpdate = (a, b, c) => { wasCalled = true; var tweet = c as Tweet; Assert.That(tweet, Is.Not.Null); Assert.That(tweet.Id, Is.EqualTo(76362320393154561)); }; // act statuses.BeginUpdate("some words go here", endBeginUpdate); Assert.That(wasCalled, Errors.CallbackDidNotFire); }