Пример #1
0
        public void ShouldGetAccountWhenSocialAccountIsNotFound()
        {
            //Arrange
            var socialAccountService = new Mock <ISocialAccountService>();

            socialAccountService.Setup(t => t.FindAccount(1, SocialUserSource.Twitter)).Returns <SocialAccount>(null);
            TwitterAccountAppService TwitterAccountAppService = new TwitterAccountAppService(socialAccountService.Object, null);
            //Act
            Action action = () => TwitterAccountAppService.GetAccount(1);

            //Assert
            Assert.Throws <ExceptionWithCode>(action);
        }
Пример #2
0
        public void ShouldGetAccount()
        {
            //Arrange
            var socialAccountService = new Mock <ISocialAccountService>();

            socialAccountService.Setup(t => t.FindAccount(1, SocialUserSource.Twitter)).Returns(
                new SocialAccount {
                Id = 1
            });
            TwitterAccountAppService TwitterAccountAppService = new TwitterAccountAppService(socialAccountService.Object, null);
            //Act
            TwitterAccountDto twitterAccountDto = TwitterAccountAppService.GetAccount(1);

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