public void GetAll_ShouldReturnBadRequest()
        {
            var mockContext = new Mock <HubDbContext>(options);

            mockContext.Setup(m => m.SocialMediaPost).Throws(new Exception());
            var controller = new SocialMediaPostsController(mockContext.Object, logger.Object, mapper);

            var result = controller.GetAllSocialMediaPosts() as ObjectResult;

            result.Should().BeOfType <BadRequestObjectResult>();
            result.StatusCode.Should().Be(400);
        }
        public void GetAll_ShouldReturnSuccessAndSorted(int postCount)
        {
            for (var i = 0; i < postCount; i++)
            {
                context.SocialMediaPost.Add(TestData.CreateDbSocialMediaPost("http://facebook.com/post/123", Guid.NewGuid(), true, postCount - i));
            }
            context.SaveChanges();

            var result   = controller.GetAllSocialMediaPosts();
            var okResult = result as ObjectResult;

            okResult.Should().BeOfType <OkObjectResult>();
            okResult.Should().NotBeNull();

            var models = okResult.Value as IList <Models.SocialMediaPost>;

            models.Should().NotBeNull();
            models.Count().Should().Be(postCount);
            for (int i = 0; i < models.Count() - 1; i++)
            {
                models[i].SortOrder.Should().BeLessThan(models[i + 1].SortOrder);
            }
        }