コード例 #1
0
ファイル: LikeServiceTests.cs プロジェクト: gdenchev99/PicMe
        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);
        }