Пример #1
0
        public void BeginVerifyCredentials_WithInlineAction_IsCalled()
        {
            // arrange
            var twitterClient = Substitute.For<IBaseTwitterClient>();
            twitterClient.SetResponse("foo");
            var account = new Account(twitterClient);

            // act
            account.BeginVerifyCredentials(user => Assert.That(user, Is.Null));
        }
Пример #2
0
        public void BeginVerifyCredentials_WithCallbackRequiringUser_IsCalled()
        {
            // arrange
            var twitterClient = Substitute.For<IBaseTwitterClient>();
            twitterClient.SetResponse("foo");
            var account = new Account(twitterClient);

            // assert
            Action<User> endVerifyCredentials = user => Assert.That(user, Is.Null);

            // act
            account.BeginVerifyCredentials(endVerifyCredentials);
        }
Пример #3
0
        public void BeginVerifyCredentials_WithInvalidResponseFromClient_DoesNotContainUser()
        {
            // act
            var twitterClient = Substitute.For<IBaseTwitterClient>();
            twitterClient.SetResponse("foo");
            var account = new Account(twitterClient);

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

            // act
            account.BeginVerifyCredentials(endVerifyCredentials);
        }
Пример #4
0
        public void BeginVerifyCredentials_WithValidResponseFromClient_ContainsUser()
        {
            // arrange
            var twitterClient = Substitute.For<IBaseTwitterClient>();
            twitterClient.SetReponseBasedOnRequestPath();
            var account = new Account(twitterClient);

            // assert
            GenericResponseDelegate endVerifyCredentials = (a, b, c) =>
            {
                var user = c as User;
                Assert.That(user, Is.Not.Null);
                Assert.That(user.ScreenName, Is.EqualTo("shiftkey"));
            };

            // act
            account.BeginVerifyCredentials(endVerifyCredentials);
        }
Пример #5
0
        public void BeginVerifyCredentials_WithNoCallback_DoesNotThrowException()
        {
            var twitterClient = Substitute.For<IBaseTwitterClient>();
            twitterClient.SetReponseBasedOnRequestPath();

            var account = new Account(twitterClient);

            // act
            account.BeginVerifyCredentials(User.DoNothing);
        }