Exemplo n.º 1
0
        public void BeginSpamBlock_WithSomeName_ProvidesParameter()
        {
            // arrange
            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 statuses = new Block(twitterClient);

            // act
            statuses.BeginSpamBlock(username, (a,b,c)=> { });
            
        }
Exemplo n.º 2
0
        public void BeginSpamBlock_WithSomeName_ReturnsUser()
        {
            var wasCalled = false;
            var twitterClient = Substitute.For<IBaseTwitterClient>();
            twitterClient.SetReponseBasedOnRequestPath();
            var statuses = new Block(twitterClient);

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

            // act
            statuses.BeginSpamBlock("abcde", endBlock);
            
            // assert
            Assert.That(wasCalled, Errors.CallbackDidNotFire);
        }