Ejemplo n.º 1
0
        public async Task BulkDeleteProviderCourseLocations_ReturnsNoContent(
            [Frozen] Mock <IMediator> mediatorMock,
            [Greedy] ProviderCourseLocationDeleteController sut,
            int ukprn, int larsCode, BulkDeleteProviderCourseLocationsCommand command)
        {
            var response = await sut.BulkDeleteProviderCourseLocations(ukprn, larsCode, command);

            (response as NoContentResult).Should().NotBeNull();
        }
Ejemplo n.º 2
0
        public async Task BulkDeleteProviderCourseLocations_InvokesCommand(
            [Frozen] Mock <IMediator> mediatorMock,
            [Greedy] ProviderCourseLocationDeleteController sut,
            int ukprn, int larsCode, BulkDeleteProviderCourseLocationsCommand command)
        {
            await sut.BulkDeleteProviderCourseLocations(ukprn, larsCode, command);

            mediatorMock.Verify(m => m.Send(command, It.IsAny <CancellationToken>()));
        }
        public async Task Handle_InvokedDeleteOnApiClient(
            [Frozen] Mock <IRoatpCourseManagementApiClient <RoatpV2ApiConfiguration> > apiClientMock,
            BulkDeleteProviderCourseLocationsCommandHandler sut,
            BulkDeleteProviderCourseLocationsCommand command)
        {
            ProviderCourseLocationsBulkDeleteRequest expectedRequest = command;
            await sut.Handle(command, new CancellationToken());

            apiClientMock.Verify(c => c.Delete(It.Is <ProviderCourseLocationsBulkDeleteRequest>(r => r.DeleteProviderCourseLocationOption == command.DeleteProviderCourseLocationOption && r.Ukprn == command.Ukprn && r.LarsCode == command.LarsCode)));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> BulkDeleteProviderCourseLocations(int ukprn, int larsCode, BulkDeleteProviderCourseLocationsCommand command)
        {
            _logger.LogInformation("Outer API: Request received to bulk delete provider course locations for ukprn: {ukprn} larscode: {larscode} option: {deleteOption}", ukprn, larsCode, command.DeleteProviderCourseLocationOption);
            command.Ukprn    = ukprn;
            command.LarsCode = larsCode;
            await _mediator.Send(command);

            return(NoContent());
        }