public async Task GivenAConvertDataRequest_WithConfiguredTemplate_WhenValidBodySent_ThenConvertDataCalledWithCorrectParams(string loginServer, string imageName, string digest, string templateCollectionReference) { _mediator.Send(Arg.Any <ConvertDataRequest>()).Returns(Task.FromResult(GetConvertDataResponse())); var ociArtifactInfo = new OciArtifactInfo { LoginServer = loginServer, ImageName = imageName, Digest = digest, }; var artifactConfig = new ArtifactStoreConfiguration(); artifactConfig.OciArtifacts.Add(ociArtifactInfo); var localController = GetController(_convertDataJobConfig, artifactConfig); var body = GetConvertDataParams(Samples.SampleHl7v2Message, "Hl7v2", templateCollectionReference, _testHl7v2RootTemplate); await localController.ConvertData(body); await _mediator.Received().Send( Arg.Is <ConvertDataRequest>( r => r.InputData.ToString().Equals(body.Parameter.Find(p => p.Name.Equals(ConvertDataProperties.InputData)).Value.ToString()) && string.Equals(r.InputDataType.ToString(), body.Parameter.Find(p => p.Name.Equals(ConvertDataProperties.InputDataType)).Value.ToString(), StringComparison.OrdinalIgnoreCase) && r.TemplateCollectionReference == body.Parameter.Find(p => p.Name.Equals(ConvertDataProperties.TemplateCollectionReference)).Value.ToString() && r.RootTemplate == body.Parameter.Find(p => p.Name.Equals(ConvertDataProperties.RootTemplate)).Value.ToString()), Arg.Any <CancellationToken>()); _mediator.ClearReceivedCalls(); }
public async Task GivenAConvertDataRequest_WithNotConfiguredTemplate_WhenValidBodySent_ThenTemplateNotConfiguredThrown(string loginServer, string imageName, string digest, string templateCollectionReference) { var ociArtifactInfo = new OciArtifactInfo { LoginServer = loginServer, ImageName = imageName, Digest = digest, }; var artifactConfig = new ArtifactStoreConfiguration(); artifactConfig.OciArtifacts.Add(ociArtifactInfo); var localController = GetController(_convertDataJobConfig, artifactConfig); var body = GetConvertDataParams(Samples.SampleHl7v2Message, "Hl7v2", templateCollectionReference, _testHl7v2RootTemplate); await Assert.ThrowsAsync <ContainerRegistryNotConfiguredException>(() => localController.ConvertData(body)); }