Exemple #1
0
        public void ShouldUpdatePageWhenAccountIsNotFound()
        {
            //Arrange
            var socialAccountService = new Mock <ISocialAccountService>();
            var socialUserService    = new Mock <ISocialUserService>();
            var fbClient             = new Mock <IFbClient>();

            socialAccountService.Setup(t => t.FindAccount(1, SocialUserSource.Facebook)).Returns <SocialAccount>(null);
            FacebookAccountAppService conversationMessageAppService = new FacebookAccountAppService(socialAccountService.Object, fbClient.Object);
            //Act
            Action action = () => conversationMessageAppService.UpdatePage(1, new UpdateFacebookPageDto {
            });

            //Assert
            Assert.Throws <ExceptionWithCode>(action);
        }
Exemple #2
0
        public void ShouldUpdatePage()
        {
            //Arrange
            var socialAccountService = new Mock <ISocialAccountService>();
            var socialUserService    = new Mock <ISocialUserService>();
            var fbClient             = new Mock <IFbClient>();

            socialAccountService.Setup(t => t.FindAccount(1, SocialUserSource.Facebook)).Returns(new SocialAccount {
                Id = 1, SocialUser = new SocialUser {
                    OriginalId = "1"
                }, Token = "123"
            });
            FacebookAccountAppService conversationMessageAppService = new FacebookAccountAppService(socialAccountService.Object, fbClient.Object);

            //Act
            FacebookPageDto facebookPageDto = conversationMessageAppService.UpdatePage(1, new UpdateFacebookPageDto {
            });

            //Assert
            Assert.NotNull(facebookPageDto);
            socialAccountService.Verify(t => t.Update(It.Is <SocialAccount>(r => r.Id == 1)));
        }