public async Task LmiImportOrchestrationTriggerImportSocItemActivityIsSuccessful() { // Arrange var dummyLmiSocDatasetModel = A.Dummy <LmiSocDatasetModel>(); var dummyGraphSocDatasetModel = A.Dummy <GraphSocDatasetModel>(); var socJobProfileMapping = new SocJobProfileMappingModel { Soc = 1234 }; A.CallTo(() => fakeLmiSocImportService.ImportAsync(A <int> .Ignored, A <List <SocJobProfileItemModel> > .Ignored)).Returns(dummyLmiSocDatasetModel); A.CallTo(() => fakeMapLmiToGraphService.Map(A <LmiSocDatasetModel> .Ignored)).Returns(dummyGraphSocDatasetModel); A.CallTo(() => fakeGraphService.ImportAsync(A <GraphSocDatasetModel> .Ignored, A <GraphReplicaSet> .Ignored)).Returns(true); // Act var result = await lmiImportOrchestrationTrigger.ImportSocItemActivity(socJobProfileMapping).ConfigureAwait(false); // Assert A.CallTo(() => fakeLmiSocImportService.ImportAsync(A <int> .Ignored, A <List <SocJobProfileItemModel> > .Ignored)).MustHaveHappenedOnceExactly(); A.CallTo(() => fakeMapLmiToGraphService.Map(A <LmiSocDatasetModel> .Ignored)).MustHaveHappenedOnceExactly(); A.CallTo(() => fakeGraphService.ImportAsync(A <GraphSocDatasetModel> .Ignored, A <GraphReplicaSet> .Ignored)).MustHaveHappenedOnceExactly(); Assert.NotNull(result); }
public async Task <Guid?> ImportSocItemActivity([ActivityTrigger] SocJobProfileMappingModel socJobProfileMapping) { _ = socJobProfileMapping ?? throw new ArgumentNullException(nameof(socJobProfileMapping)); logger.LogInformation($"Importing SOC: {socJobProfileMapping.Soc}"); var lmiSocDataset = await lmiSocImportService.ImportAsync(socJobProfileMapping.Soc !.Value, socJobProfileMapping.JobProfiles).ConfigureAwait(false); if (lmiSocDataset != null) { var graphSocDataset = mapLmiToGraphService.Map(lmiSocDataset); if (await graphService.ImportAsync(graphSocDataset).ConfigureAwait(false)) { return(graphSocDataset !.ItemId); } } return(null); }