public void Invoke_AnyUserSavedThisFolloweeById_In_userFolloweeService_When_Provided_Correct_Parameters() { //Arrange var fakeUserTweetSetvice = Mock.Of <IUserTweetService>(); var fakeUserFolloweeService = new Mock <IUserFolloweeService>(); var fakeUnit = new Mock <IUnitOfWork>(); var fakeFolloweeService = Mock.Of <IFolloweeService>(); var fakeTweetService = Mock.Of <ITweetService>(); var fakeTweetTagService = Mock.Of <ITweetTagService>(); var fakeAdminUserService = Mock.Of <IAdminUserService>(); var sut = new CascadeDeleteService(fakeUserTweetSetvice, fakeUserFolloweeService.Object, fakeUnit.Object, fakeFolloweeService, fakeTweetService, fakeTweetTagService, fakeAdminUserService); var fakeUserFolloweeRepo = new Mock <IGenericRepository <UserFollowee> >(); var fakeUserTweetRepo = new Mock <IGenericRepository <UserTweet> >(); var userFollowees = new List <UserFollowee>(); var userTweets = new List <UserTweet>(); fakeUserFolloweeRepo.Setup(r => r.All).Returns(userFollowees.AsQueryable()); fakeUserTweetRepo.Setup(r => r.All).Returns(userTweets.AsQueryable()); fakeUnit.Setup(u => u.UserFollowees).Returns(fakeUserFolloweeRepo.Object); fakeUnit.Setup(u => u.UserTweets).Returns(fakeUserTweetRepo.Object); fakeUserFolloweeService.Setup(s => s.AnyUserSavedThisFolloweeById(It.IsAny <string>())).Verifiable(); //Act sut.DeleteUserFolloweeAndEntries("123", "456"); //Assert fakeUserFolloweeService.Verify(v => v.AnyUserSavedThisFolloweeById(It.IsAny <string>()), Times.Once); }
public void Throw_Argument_Null_When_UserId_Is_Null() { //Arrange var fakeUserTweetSetvice = Mock.Of <IUserTweetService>(); var fakeUserFolloweeService = Mock.Of <IUserFolloweeService>(); var fakeUnit = Mock.Of <IUnitOfWork>(); var fakeFolloweeService = Mock.Of <IFolloweeService>(); var fakeTweetService = Mock.Of <ITweetService>(); var fakeTweetTagService = Mock.Of <ITweetTagService>(); var fakeAdminUserService = Mock.Of <IAdminUserService>(); var sut = new CascadeDeleteService(fakeUserTweetSetvice, fakeUserFolloweeService, fakeUnit, fakeFolloweeService, fakeTweetService, fakeTweetTagService, fakeAdminUserService); //Act & Assert Assert.ThrowsException <ArgumentNullException>(() => sut.DeleteUserFolloweeAndEntries("456", null)); }