Ejemplo n.º 1
0
        public async Task ExistsAsync_WithValidLikeId_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);

            // Act
            bool likeExists = await service.ExistsAsync(26);       // Valid id.

            bool likeExistsTwo = await service.ExistsAsync(59135); // Invalid id.

            // Assert
            Assert.True(likeExists);
            Assert.False(likeExistsTwo);
        }