Exemplo n.º 1
0
        public async void CanReadSinglePost()
        {
            DbContextOptions <PostDbContext> options = new DbContextOptionsBuilder <PostDbContext>().UseInMemoryDatabase("GetAPost").Options;

            using (PostDbContext context = new PostDbContext(options))
            {
                PostManager service = new PostManager(context);
                Post        post    = new Post();
                post.ID          = 1;
                post.PosterName  = "tester";
                post.URL         = "test.jpg";
                post.Description = "this is a test post";
                await service.SaveAsync(post);

                Post result = await service.FindPostAsync(post.ID);

                Assert.Equal(post, result);
            }
        }