public async Task EditPostContentShouldReturnCreatedPostIdUsingDbContext() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()); var repository = new EfDeletableEntityRepository <Post>(new ApplicationDbContext(options.Options)); repository.AddAsync(new Post { Id = 1, CategoryId = 2, Title = "test", Description = "notChanged" }).GetAwaiter().GetResult(); repository.SaveChangesAsync().GetAwaiter().GetResult(); var postService = new PostsService(repository); AutoMapperConfig.RegisterMappings(typeof(MyTestPost).Assembly); var post = postService.EditPostContent(1, "description"); //var byCategoryId = postService.GetByCategoryId<MyTestPost>(1); //var findPost = byCategoryId.Where(x => x.Title == "title").FirstOrDefault(); Assert.Equal(1, post.Id); //Assert.Equal("description", post.GetType().FullName); }