private async Task CreateEmploymentCheckCompleteEvent(string nationalInsuranceNumber, long uln, long employerAccountId, long ukprn, bool checkPassed)
 {
     var completeEvent = new EmploymentCheckCompleteEvent(nationalInsuranceNumber, uln, employerAccountId, ukprn, DateTime.Now, checkPassed);
     var genericEvent  = new GenericEvent {
         CreatedOn = DateTime.Now, Payload = JsonConvert.SerializeObject(completeEvent), Type = completeEvent.GetType().Name
     };
     await _eventsApi.CreateGenericEvent(genericEvent);
 }
예제 #2
0
        public async Task ThenTheEmploymentCheckIsSaved()
        {
            var expectedEmploymentCheck = new EmploymentCheckCompleteEvent();

            await _commandHandler.Handle(new CreateEmploymentCheckCommand { Event = expectedEmploymentCheck });

            _repository.Verify(x => x.SaveEmploymentCheck(expectedEmploymentCheck), Times.Once);
        }
예제 #3
0
        public async Task SaveEmploymentCheck(EmploymentCheckCompleteEvent @event)
        {
            await WithConnection(async c =>
            {
                var parameters = new DynamicParameters();
                parameters.Add("@nationalInsuranceNumber", @event.NationalInsuranceNumber, DbType.String);
                parameters.Add("@uln", @event.Uln, DbType.Int64);
                parameters.Add("@employerAccountId", @event.EmployerAccountId, DbType.Int64);
                parameters.Add("@ukprn", @event.Ukprn, DbType.Int64);
                parameters.Add("@checkDate", @event.CheckDate, DbType.DateTime);
                parameters.Add("@checkPassed", @event.CheckPassed, DbType.Boolean);

                return(await c.ExecuteAsync(
                           sql: "[Data_Load].[CreateEmploymentCheck]",
                           param: parameters,
                           commandType: CommandType.StoredProcedure));
            });
        }