public async Task HandleRequestAsync(AccessInfo accessInfo) { string?plantId = await _plantService.GetPlantIdAsync(accessInfo.PlantOid); if (plantId == null) { _logger.LogInformation(Resources.GroupDoesNotExist); return; } if (MessageHasNoRelevantData(accessInfo)) { return; } // Set person CreatedBy cache await _personService.SetPersonCreatedByCache(); _logger.LogInformation($"Updating access for {accessInfo.Members.Count} members to plant {plantId}"); await UpdateMemberInfo(accessInfo.Members, plantId); await UpdateMemberAccess(accessInfo.Members, plantId); await UpdateMemberVoidedStatus(accessInfo.Members); }
public async Task GetPlantIdTest() { //Arrange const string existingPlantOid = "someOid"; const string existingPlantId = "somePlantId"; _mockRepository.Setup(r => r.GetPlantIdByOidAsync(existingPlantOid)) .Returns(Task.FromResult <string?>(existingPlantId)); //Act var result = await _plantService.GetPlantIdAsync(existingPlantOid); //Assert Assert.AreEqual(existingPlantId, result); }