public async Task Then_The_Request_Is_Handled_And_The_Import_Locations_Called( ImportDataCommand command, [Frozen] Mock <ILocationImportService> importService, ImportDataCommandHandler handler) { await handler.Handle(command, It.IsAny <CancellationToken>()); importService.Verify(x => x.Import(), Times.Once); }
public async Task Then_The_IndexBuilder_Is_Invoked( ImportDataCommand command, [Frozen] Mock <IIndexBuilder> indexBuilder, ImportDataCommandHandler handler ) { // Act await handler.Handle(command, new CancellationToken()); //Assert indexBuilder.Verify(x => x.Build(), Times.Once); }
public async Task Then_If_LarsData_Is_Not_Imported_Then_LarsData_Is_Not_Loaded( ImportDataCommand command, [Frozen] Mock <ILarsImportService> larsImportService, ImportDataCommandHandler handler ) { //Arrange larsImportService.Setup(s => s.ImportDataIntoStaging()).ReturnsAsync((false, null)); // Act await handler.Handle(command, new CancellationToken()); //Assert larsImportService.Verify(x => x.LoadDataFromStaging(It.IsAny <DateTime>(), It.IsAny <string>()), Times.Never); }
public async Task Then_The_Services_Are_Called_To_Import_Data( ImportDataCommand command, [Frozen] Mock <IStandardsImportService> standardsImportService, [Frozen] Mock <ILarsImportService> larsImportService, [Frozen] Mock <IFrameworksImportService> frameworksImportService, ImportDataCommandHandler handler) { // Act await handler.Handle(command, new CancellationToken()); //Assert larsImportService.Verify(x => x.ImportDataIntoStaging(), Times.Once); frameworksImportService.Verify(x => x.ImportDataIntoStaging(), Times.Once); standardsImportService.Verify(x => x.ImportDataIntoStaging(), Times.Once); }
public async Task Then_The_Service_Is_Called_To_Import_Data( ImportDataCommand command, [Frozen] Mock <IProviderCourseImportService> providerStandardsImportService, [Frozen] Mock <INationalAchievementRatesImportService> nationalAchievementRatesImportService, [Frozen] Mock <INationalAchievementRatesOverallImportService> nationalAchievementRatesOverallImportService, [Frozen] Mock <IProviderRegistrationImportService> providerRegistrationImportService, [Frozen] Mock <IProviderRegistrationAddressImportService> providerRegistrationAddressImportService, ImportDataCommandHandler handler) { // Act await handler.Handle(command, new CancellationToken()); //Assert providerStandardsImportService.Verify(x => x.ImportProviderCourses(), Times.Once); nationalAchievementRatesImportService.Verify(x => x.ImportData(), Times.Once); nationalAchievementRatesOverallImportService.Verify(x => x.ImportData(), Times.Once); providerRegistrationImportService.Verify(x => x.ImportData(), Times.Once); providerRegistrationAddressImportService.Verify(x => x.ImportAddressData(), Times.Once); }
public async Task Then_The_Services_Are_Called_To_Load_Data_From_Staging( ImportDataCommand command, string frameworkFile, string larsFile, [Frozen] Mock <IStandardsImportService> standardsImportService, [Frozen] Mock <ILarsImportService> larsImportService, [Frozen] Mock <IFrameworksImportService> frameworksImportService, [Frozen] Mock <IIndexBuilder> indexBuilder, ImportDataCommandHandler handler ) { frameworksImportService.Setup(s => s.ImportDataIntoStaging()).ReturnsAsync((true, frameworkFile)); larsImportService.Setup(s => s.ImportDataIntoStaging()).ReturnsAsync((true, larsFile)); // Act await handler.Handle(command, new CancellationToken()); //Assert larsImportService.Verify(x => x.LoadDataFromStaging(It.IsAny <DateTime>(), larsFile), Times.Once); frameworksImportService.Verify(x => x.LoadDataFromStaging(It.IsAny <DateTime>(), frameworkFile), Times.Once); standardsImportService.Verify(x => x.LoadDataFromStaging(It.IsAny <DateTime>()), Times.Once); indexBuilder.Verify(x => x.Build(), Times.Once); }