예제 #1
0
        public void DeleteReplyByIdShouldReturnTrue()
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(databaseName: "DeleteReplyById_Comments_Roads_Database")
                          .Options;
            var dbContext = new ApplicationDbContext(options);

            var roadsService = new RoadsService(dbContext, null, null, null, null, null);

            var commentsService = new CommentsService(roadsService, dbContext);


            var reply = new Reply
            {
                Id = "replyId1",
            };

            dbContext.Replies.Add(reply);
            dbContext.SaveChanges();

            var result = commentsService.DeleteReply(reply.Id);

            //  Assert.Empty(dbContext.Replies);
            Assert.True(result);
        }