Exemplo n.º 1
0
        public void ShouldDeleteAccountAsyncWhenSocialAccountIsNotFound()
        {
            //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
            Func <Task> action = () => TwitterAccountAppService.DeleteAccountAsync(1);

            //Assert
            Assert.ThrowsAsync <ExceptionWithCode>(action);
        }
Exemplo n.º 2
0
        public void ShouldDeleteAccountAsync()
        {
            //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
            TwitterAccountAppService.DeleteAccountAsync(1);
            //Assert
            socialAccountService.Verify(t => t.DeleteAsync(It.Is <SocialAccount>(r => r.Id == 1)));
        }