Exemplo n.º 1
0
        public void ExtractCaptureFromRequest(string request, Action <string, Guid, Guid, string> onValueExtraction)
        {
            GreenLogger.Log("Extracting capture from request");

            RequestBodyElement body = request.ToXDocument().GetInsureServeMessage().RequestBody;
            ProductLineCode    code = ProductLineCode.Parse(body.BusinessTransaction.ProductLineCode.Value);

            State.ProductLines[code].ExtractCaptureFromRisk(body.PolMessage.InputPolData, onValueExtraction);
        }
Exemplo n.º 2
0
        public void ExtractMapFromRequest(string request)
        {
            GreenLogger.Log("Extract risk capture map from request");

            RequestBodyElement body        = request.ToXDocument().GetInsureServeMessage().RequestBody;
            ProductLineCode    productLine = ProductLineCode.Parse(body.BusinessTransaction.ProductLineCode.Value);

            if (!State.ProductLines.ContainsKey(productLine))
            {
                GreenLogger.Log("new risk product line mapped for {0}", productLine);
                Then(new NewRiskProductLineMapped(productLine));
            }

            State.ProductLines[productLine].ExtractMapFromRisk(body.PolMessage.InputPolData);
        }
Exemplo n.º 3
0
        protected virtual TypeSyntax GetTypeName()
        {
            ILocatedOpenApiElement <OpenApiMediaType>?mediaType = MediaTypeSelector.Select(RequestBodyElement);

            if (mediaType == null)
            {
                throw new InvalidOperationException("No valid media type for this request");
            }

            ILocatedOpenApiElement <OpenApiSchema>?schemaElement = mediaType.GetSchema();

            if (schemaElement != null &&
                (schemaElement.Element.Type != "object" || schemaElement.Element.Reference != null))
            {
                return(Context.SchemaGeneratorRegistry.Get(schemaElement).TypeName);
            }

            INameFormatter formatter = Context.NameFormatterSelector.GetFormatter(NameKind.Class);
            NameSyntax     ns        = Context.NamespaceProvider.GetNamespace(RequestBodyElement);

            if (RequestBody.Reference != null)
            {
                // We're in the components section

                return(SyntaxFactory.QualifiedName(ns,
                                                   SyntaxFactory.IdentifierName(formatter.Format(RequestBody.Reference.Id + "RequestBody"))));
            }
            else
            {
                // We're in an operation

                var operation = RequestBodyElement.Parents().OfType <LocatedOpenApiElement <OpenApiOperation> >().First().Element;

                return(SyntaxFactory.QualifiedName(ns,
                                                   SyntaxFactory.IdentifierName(formatter.Format(operation.OperationId + "RequestBody"))));
            }
        }