public async Task Then_feedback_entry_is_inserted()
        {
            var createdDateTime = new DateTime(2018, 2, 3);

            SystemTime.UtcNow = () => createdDateTime;

            var dataContext = DataContextHelpers.GetInMemoryDataContext();

            var applicationId = Guid.NewGuid();
            var sectionId     = Guid.NewGuid();

            var section = new ApplicationSection
            {
                ApplicationId = applicationId,
                Id            = sectionId,
                QnAData       = new QnAData
                {
                    Pages = new List <Page>
                    {
                        new Page
                        {
                            PageId = "1"
                        }
                    }
                }
            };

            await dataContext.ApplicationSections.AddAsync(section);

            await dataContext.SaveChangesAsync();

            var handler = new UpsertFeedbackHandler(dataContext);

            var newFeedbackId = Guid.NewGuid();
            await handler.Handle(new UpsertFeedbackRequest(applicationId, sectionId, "1",
                                                           new Feedback
            {
                Date = DateTime.UtcNow,
                From = "Dave",
                Id = newFeedbackId,
                Message = "Feedback message"
            }), CancellationToken.None);

            var updatedSection = await dataContext.ApplicationSections.SingleAsync();

            var updatedPage = updatedSection.QnAData.Pages[0];

            updatedPage.Feedback.Should().NotBeNullOrEmpty();
            updatedPage.Feedback.Count.Should().Be(1);

            var insertedFeedback = updatedPage.Feedback[0];

            insertedFeedback.Date.Should().Be(createdDateTime);
            insertedFeedback.From.Should().Be("Dave");
            insertedFeedback.Id.Should().Be(newFeedbackId);
            insertedFeedback.Message.Should().Be("Feedback message");
            insertedFeedback.IsNew.Should().BeTrue();
            insertedFeedback.IsCompleted.Should().BeFalse();
        }
        public async Task SetUp()
        {
            _dataContext = DataContextHelpers.GetInMemoryDataContext();

            _applicationId = Guid.NewGuid();
            _sectionId     = Guid.NewGuid();

            _feedbackId = Guid.NewGuid();
            var section = new ApplicationSection
            {
                ApplicationId = _applicationId,
                Id            = _sectionId,
                QnAData       = new QnAData
                {
                    Pages = new List <Page>
                    {
                        new Page
                        {
                            PageId   = "1",
                            Feedback = new List <Feedback>
                            {
                                new Feedback
                                {
                                    Id = _feedbackId
                                }
                            }
                        }
                    }
                }
            };

            await _dataContext.ApplicationSections.AddAsync(section);

            await _dataContext.SaveChangesAsync();

            _handler = new UpsertFeedbackHandler(_dataContext);
        }