Ejemplo n.º 1
0
 public void Given_Posts_When_NewPostIsAdded_Then_ShouldHaveOnePostInDatabase()
 {
     RunOnDatabase(async context => {
         // ARRANGE
         var postsRepository = new PostsRepository(context, _loggerFactory);
         var post            = await postsRepository.InsertPostAsync(new Post
         {
             City         = "Test city",
             Country      = "Test country",
             Description  = "Description",
             Domain       = "Domain",
             FirstName    = "FirstName",
             Gender       = "Male",
             Id           = 10,
             PostDate     = new DateTime(2010, 10, 2),
             LastName     = "LastName",
             UploadedSong = null
         });
         // ACT
         var result = postsRepository.GetPostAsync(post.Id);
         // ASSERT
         result.Should().NotBe(null);
     });
 }
Ejemplo n.º 2
0
        public async Task <ActionResult> Get([RequiredFromQuery] string postId)
        {
            var post = await _postRepository.GetPostAsync(postId);

            return(Ok(post));
        }