public async void ItShouldSendAnEmailAndReturnAStatusCodeOf200()
        {
            _emailClient.Setup(e => e.SendEmailToService(It.Is <EmailMessage>(message => message.ToEmail == AppSetting.GetAppSetting("EventSubmissionEmail").ToString()))).ReturnsAsync(HttpStatusCode.OK);

            var response = await _eventEmailBuilder.SendEmailAddNew(new EventSubmission()
            {
                EventDate = new DateTime(2017, 9, 9)
            });

            response.Should().Be(HttpStatusCode.OK);
        }
        public async Task <IActionResult> AddYourEvent(EventSubmission eventSubmission)
        {
            if (!ModelState.IsValid)
            {
                ViewBag.SubmissionError = GetErrorsFromModelState(ModelState);
                return(View("Add-Your-Event", eventSubmission));
            }

            if (eventSubmission.IsRecurring)
            {
                Enum.TryParse(eventSubmission.Frequency, out EventFrequency frequency);
                if (frequency != EventFrequency.None)
                {
                    eventSubmission.Occurrences = _dateCalculator.GetEventOccurences(frequency, (DateTime)eventSubmission.EventDate, (DateTime)eventSubmission.EndDate);
                }
            }

            var successCode = await _emailBuilder.SendEmailAddNew(eventSubmission);

            if (successCode == HttpStatusCode.OK)
            {
                return(RedirectToAction("ThankYouMessage"));
            }

            ViewBag.SubmissionError = "There was a problem submitting the event, please try again.";

            return(View("Add-Your-Event", eventSubmission));
        }