Exemplo n.º 1
0
        public XModuleAttribute SetupAttributes(XModule mainModule, HtmlElement iframe)
        {
            XModuleAttribute iframeAttribute = mainModule.CreateModuleAttribute();

            iframeAttribute.Name = iframe.TagName;
            iframeAttribute.DefaultActionMode = XTestStepActionMode.Select;
            iframeAttribute.Cardinality       = "0-1";
            iframeAttribute.BusinessType      = "HtmlFrame";


            AddBusinessParam(iframeAttribute.CreateConfigurationParam(), "Engine", "Html");
            AddBusinessParam(iframeAttribute.CreateConfigurationParam(), "BusinessAssociation", "Descendants");
            AddBusinessParam(iframeAttribute.CreateTechnicalIDParam(), "Id", iframe.Id);
            AddBusinessParam(iframeAttribute.CreateTechnicalIDParam(), "Tag", iframe.TagName);

            var htmlDocumentAttr = iframeAttribute.CreateModuleAttribute();

            htmlDocumentAttr.Name              = "HtmlDocument";
            htmlDocumentAttr.BusinessType      = "HtmlDocument";
            htmlDocumentAttr.Cardinality       = "0-1";
            htmlDocumentAttr.DefaultActionMode = XTestStepActionMode.Select;
            AddBusinessParam(htmlDocumentAttr.CreateConfigurationParam(), "BusinessAssociation", "Descendants");
            AddBusinessParam(htmlDocumentAttr.CreateConfigurationParam(), "Engine", "Html");

            return(htmlDocumentAttr);
        }
Exemplo n.º 2
0
        //TODO:
        //When you run this you get an exception. Run in Tosca and fix it derp
        private IEnumerable <XModuleAttribute> CreateClassStructure(XModuleAttribute parent, Type type, XTestStepActionMode defaultMode, int currentDepth, bool isParameter)
        {
            currentDepth++;
            if (currentDepth > MAX_DEPTH)
            {
                yield break;
            }
            //Loop through properties
            var properties = type.GetProperties().Where(x => x.SetMethod.IsPublic);

            foreach (var property in properties)
            {
                var childAttribute = parent.CreateModuleAttribute();
                BuildModuleAttribute(childAttribute, property.Name, property.PropertyType, currentDepth, isParameter, defaultMode);
                yield return(childAttribute);
            }
        }