Exemplo n.º 1
0
        public void BeginDestroy_WithValidUser_SetsParameter()
        {
            const string username = "******";
            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("screen_name", username));
            var friendships = new Friendship(twitterClient);

            GenericResponseDelegate endSearch = (a, b, c) => { };

            // act
            friendships.BeginDestroy(username, endSearch);
        }
Exemplo n.º 2
0
        public void BeginDestroy_WithValidUserName_ReturnsValidUser()
        {
            var wasCalled = false;
            var twitterClient = Substitute.For<IBaseTwitterClient>();
            twitterClient.SetReponseBasedOnRequestPath();
            var friendships = new Friendship(twitterClient);

            // assert
            GenericResponseDelegate endCreate = (a, b, c) =>
            {
                wasCalled = true;
                var results = c as User;
                Assert.That(results, Is.Not.Null);
            };

            // act
            friendships.BeginDestroy("abcde", endCreate);

            Assert.That(wasCalled, Errors.CallbackDidNotFire);
        }