Ejemplo n.º 1
0
        public async Task RemoveAsync_WithValidData_ShouldReturnTrue()
        {
            // Arrange
            var context         = InMemoryDbContext.Initiliaze();
            var likesRepository = new EfRepository <Like>(context);
            var usersRepository = new EfRepository <ApplicationUser>(context);
            var postsRepository = new EfRepository <Post>(context);
            var service         = new LikesService(likesRepository, usersRepository, postsRepository);

            await this.SeedUserAndPost(context);

            await this.SeedLikes(context);

            var model = new AddLikeModel {
                UserId = "userId", PostId = 52
            };

            // Act
            bool isLikeDeleted = await service.RemoveAsync(model);

            // Assert
            Assert.True(isLikeDeleted);
        }