Exemplo n.º 1
0
        public void BeginUpdateProfileImage_WithInvalidFile_DoesNotSend()
        {
            // arrange
            var twitterClient = Substitute.For<IBaseTwitterClient>();
            twitterClient.When(a => a.BeginRequest(Arg.Any<string>(), null, Arg.Any<IDictionary<string, RESTBase.File>>(), Arg.Any<WebMethod>(), Arg.Any<RestCallback>()))
                       .Do(c =>
                       {
                           var files = c.Args()[2] as IDictionary<string, RESTBase.File>;
                           Assert.That(files.Count() == 0);
                       });

            var account = new Account(twitterClient);
            var f = new FileInfo("fakefile.foo");

            // act
            account.BeginUpdateProfileImage(f, User.DoNothing);
        }
Exemplo n.º 2
0
        public void BeginUpdateProfileImage_WithValidResponseFromClient_ContainsUser()
        {
            var twitterClient = Substitute.For<IBaseTwitterClient>();
            twitterClient.SetResponseWitHFileBasedOnRequestPath();
            var account = new Account(twitterClient);

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

            var f = new FileInfo("akihabara.png");

            // act
            account.BeginUpdateProfileImage(f, endUpdateProfileImage);
        }
Exemplo n.º 3
0
        public void BeginUpdateProfileImage_WithNoCallback_DoesNotThrowException()
        {
            // arrange
            var twitterClient = Substitute.For<IBaseTwitterClient>();
            twitterClient.SetResponseWitHFileBasedOnRequestPath();
          
            var account = new Account(twitterClient);
            var f = new FileInfo("akihabara.png");

            // act
            account.BeginUpdateProfileImage(f, User.DoNothing);
        }