Ejemplo n.º 1
0
        public void AddImageUrlShouldAddImageUrlToPost()
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(databaseName: "AddImageUrlShouldAddImageUrlToPost")
                          .Options;

            var dbContext = new ApplicationDbContext(options);

            var commentService = new Mock <ICommentService>();
            var reportService  = new Mock <IReportService>();
            var userService    = new Mock <IUserService>();

            var postService = new PostService(dbContext, commentService.Object, reportService.Object, userService.Object);

            var    post   = new Post();
            string imgUrl = "asdasdasd";

            dbContext.Posts.Add(post);
            dbContext.SaveChanges();

            postService.AddImageUrl(post.Id, imgUrl);

            Assert.Equal(imgUrl, post.FilePath);
        }