public static void ConstructRequestBodyMapper(TSValue value, Parameter requestBody)
        {
            IModelType requestBodyModelType = requestBody.ModelType;

            if (requestBodyModelType is CompositeType)
            {
                string mapperReference = $"Mappers.{requestBodyModelType.Name}";
                if (!requestBody.IsRequired)
                {
                    value.Text(mapperReference);
                }
                else
                {
                    value.Object(mapperObject =>
                    {
                        mapperObject.Spread(mapperReference);
                        mapperObject.BooleanProperty("required", true);
                    });
                }
            }
            else
            {
                ConstructMapper(
                    value,
                    requestBodyModelType,
                    requestBody.SerializedName,
                    requestBody,
                    isPageable: false,
                    expandComposite: false,
                    isXML: requestBody.Parent.CodeModel.ShouldGenerateXmlSerialization == true,
                    xmlName: requestBodyModelType.XmlProperties?.Name);
            }
        }
Esempio n. 2
0
        public void Test_TSValueEditorPresenter_Common()
        {
            var view   = Substitute.For <ITSValueEditorView>();
            var model  = new ALModel(null);
            var record = new TSValue();

            var presenter = new TSValueEditorPresenter(view);

            presenter.SetContext(model, record);
            Assert.IsTrue(presenter.ApplyChanges());
        }
Esempio n. 3
0
        protected override void AddHandler(object sender, EventArgs e)
        {
            var record = new TSValue();

            using (var dlg = new TSValueEditDlg()) {
                dlg.SetContext(fModel, record);

                if (dlg.ShowModal())
                {
                    fModel.TSDB.InsertValue(fPointId, record.Timestamp, record.Value);
                    UpdateContent();
                }
            }
        }
        public static void ConstructResponseBodyMapper(TSValue value, Response response, Method method)
        {
            IModelType responseBodyModelType = response.Body;

            if (responseBodyModelType is CompositeType)
            {
                value.Text($"Mappers.{responseBodyModelType.Name}");
            }
            else
            {
                ConstructMapper(
                    value: value,
                    type: responseBodyModelType,
                    serializedName: "parsedResponse",
                    parameter: null,
                    isPageable: false,
                    expandComposite: false,
                    isXML: method.CodeModel.ShouldGenerateXmlSerialization == true);
            }
        }
 public static void ConstructMapper(TSValue value, IModelType type, string serializedName, IVariable parameter, bool isPageable, bool expandComposite, bool isXML, bool isCaseSensitive = true, string xmlName = null)
 {
     value.Object(mapper => ConstructMapper(mapper, type, serializedName, parameter, isPageable, expandComposite, isXML, isCaseSensitive, xmlName));
 }
Esempio n. 6
0
 public void SetContext(IModel model, TSValue record)
 {
     fPresenter.SetContext(model, record);
 }