Ejemplo n.º 1
0
        public void ShouldGetPageByIdWhenFacebookPageNotExists()
        {
            //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.GetPage(1);

            //Assert
            Assert.Throws <ExceptionWithCode>(action);
        }
Ejemplo n.º 2
0
        public void ShouldGetPageById()
        {
            //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
            });
            FacebookAccountAppService conversationMessageAppService = new FacebookAccountAppService(socialAccountService.Object, fbClient.Object);

            //Act
            FacebookPageDto facebookPageListDtos = conversationMessageAppService.GetPage(1);

            //Assert
            Assert.NotNull(facebookPageListDtos);
            Assert.Equal(1, facebookPageListDtos.Id);
        }