public void WhenTheAccountProjectionIsGenerated()
        {
            var defaultCalendarPeriod = new Messages.Projections.CalendarPeriod
            {
                Year  = DateTime.Today.Year,
                Month = DateTime.Today.Month,
                Day   = 20
            };

            TriggerProjectionForAccount(defaultCalendarPeriod);
        }
        public void WhenTheAccountProjectionIsTriggeredBeforeLevyHasBeenDeclared()
        {
            var defaultCalendarPeriod = new Messages.Projections.CalendarPeriod
            {
                Year  = DateTime.Today.Year,
                Month = DateTime.Today.Month,
                Day   = 18
            };

            TriggerProjectionForAccount(defaultCalendarPeriod);
        }
        private void TriggerProjectionForAccount(Messages.Projections.CalendarPeriod defaultCalendarPeriod)
        {
            var startPeriodJson = ScenarioContext.Current.ContainsKey("projections_start_period")
                ? ProjectionsStartPeriod.ToJson()
                : defaultCalendarPeriod.ToJson();

            DeleteAccountProjections(Config.EmployerAccountId);
            var projectionUrl =
                Config.ProjectionLevyFunctionUrl.Replace("{employerAccountId}", Config.EmployerAccountId.ToString());

            Console.WriteLine($"Sending levy event to levy function: {projectionUrl}, payload: {startPeriodJson}");
            var response = HttpClient
                           .PostAsync(projectionUrl, new StringContent(startPeriodJson, Encoding.UTF8, "application/json")).Result;

            Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
        }
 public void GivenTheStartMonthShouldBeThisMonthRatherThanNextMonth()
 {
     ProjectionsStartPeriod = new Messages.Projections.CalendarPeriod {
         Month = DateTime.Today.Month - 1, Year = DateTime.Today.Year
     };
 }