Exemple #1
0
        public async Task WhenPostIsSavedThenItShouldInsertNewEntry()
        {
            var             blogContext = new BlogContext(dbContextOptions);
            PostsRepository repository  = new PostsRepository(blogContext);
            var             newPost     = new Post()
            {
                Id           = 0,
                Title        = "This is Post Title",
                Summary      = "This is summary",
                PostContents = "This represents contents of the post",
                Slug         = "some-slug",
                IsPublished  = true
            };

            await repository.CreateAsync(newPost);

            Assert.Equal(1, await blogContext.Posts.CountAsync());
        }