Exemplo n.º 1
0
        public void Return_False_When_UserFollowee_Does_Not_Exist()
        {
            //Arrange
            var fakeUnit             = new Mock <IUnitOfWork>();
            var fakeDateTimeProvider = Mock.Of <IDateTimeProvider>();
            var fakeFolloweeService  = Mock.Of <IFolloweeService>();
            var sut = new UserFolloweeService(fakeUnit.Object, fakeFolloweeService, fakeDateTimeProvider);

            var fakeUserFolloweeRepo = new Mock <IGenericRepository <UserFollowee> >();

            var userFollowee = new UserFollowee {
                UserId = "123", FolloweeId = "456"
            };

            var userFolloweeCollection = new List <UserFollowee> {
                userFollowee
            };

            fakeUserFolloweeRepo.Setup(r => r.AllAndDeleted).Returns(userFolloweeCollection.AsQueryable());
            fakeUnit.Setup(u => u.UserFollowees).Returns(fakeUserFolloweeRepo.Object);

            //Act
            var exists = sut.UserFolloweeExistsInDeleted(userFollowee.UserId, "789");

            //Assert
            Assert.IsFalse(exists);
        }
Exemplo n.º 2
0
        public void Throw_Argument_Null_Exception_When_FolloweeId_Is_Null()
        {
            //Arrange
            var fakeUnit             = Mock.Of <IUnitOfWork>();
            var fakeDateTimeProvider = Mock.Of <IDateTimeProvider>();
            var fakeFolloweeService  = Mock.Of <IFolloweeService>();

            var sut = new UserFolloweeService(fakeUnit, fakeFolloweeService, fakeDateTimeProvider);

            //Act & Assert
            Assert.ThrowsException <ArgumentNullException>(() => sut.UserFolloweeExistsInDeleted("Petka", null));
        }