public void TestFallbackType(int totalDigits, bool useTypeAsFallback, string expectedType) { var xsd = @$ "<?xml version=" "1.0" " encoding=" "UTF-8" "?> <xs:schema elementFormDefault=" "qualified" " xmlns:xs=" "http://www.w3.org/2001/XMLSchema" "> <xs:complexType name=" "document" "> <xs:sequence> <xs:element name=" "someValue" "> <xs:simpleType> <xs:restriction base=" "xs:integer" "> <xs:totalDigits value=" "{totalDigits}" "/> </xs:restriction> </xs:simpleType> </xs:element> </xs:sequence> </xs:complexType> </xs:schema>"; var generatedType = ConvertXml(nameof(TestTotalDigits), xsd, new Generator { NamespaceProvider = new NamespaceProvider { GenerateNamespace = key => "Test" }, IntegerDataType = typeof(long), UseIntegerDataTypeAsFallback = useTypeAsFallback }); var expectedProperty = $"public {expectedType} SomeValue"; Assert.Contains(expectedProperty, generatedType.First()); }
public Domains Getschema(int id) { schema schema = db.schemata.Find(id); if (schema == null) { throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound)); } Domains domain = new Domains(); domain.Id = schema.id; domain.Name = schema.name; domain.Description = schema.description; domain.DomainAreas = schema.schema_domain.AsEnumerable() .Select(x => new DomainArea { Id = x.domainid, ColumnName = x.domain_variable.column_name, MicroLabel = x.domain_variable.micro_label, LongDescription = x.domain_variable.long_description, Unit = x.domain_variable.unit, Year = x.domain_variable.year, DecimalPlaces = x.domain_variable.decimal_places, ClassificationType = x.domain_variable.classification_type, AggType = x.domain_variable.agg_type, AggFormula = x.domain_variable.agg_formula }).ToList(); return(domain); }
public void CreateSchemaTest() { var schema = new schema(); var globalAttr = new attribute(new topLevelAttribute() { name = "name" }); var globalEl = new element(new topLevelElement() { name = "anElement", complexType = new localComplexType() { attribute = { new attributeType() { @ref = new XmlQualifiedName("name") } } } }); schema.attribute.Add(globalAttr); schema.element.Add(globalEl); Assert.IsNotEmpty(schema.attribute); Assert.IsNotEmpty(schema.element); }
public void TestInclusiveRange(long minInclusive, long maxInclusive, string expectedType) { var xsd = @$ "<?xml version=" "1.0" " encoding=" "UTF-8" "?> <xs:schema elementFormDefault=" "qualified" " xmlns:xs=" "http://www.w3.org/2001/XMLSchema" "> <xs:complexType name=" "document" "> <xs:sequence> <xs:element name=" "someValue" "> <xs:simpleType> <xs:restriction base=" "xs:integer" "> <xs:minInclusive value=" "{minInclusive}" "/> <xs:maxInclusive value=" "{maxInclusive}" "/> </xs:restriction> </xs:simpleType> </xs:element> </xs:sequence> </xs:complexType> </xs:schema>"; var generatedType = ConvertXml(nameof(TestTotalDigits), xsd, new Generator { NamespaceProvider = new NamespaceProvider { GenerateNamespace = key => "Test" } }); var expectedProperty = $"public {expectedType} SomeValue"; Assert.Contains(expectedProperty, generatedType.First()); }
internal static List<ReportEntry> Process(schema schema, Stream docToValidateStream, List<Phase> phases) { var result = new List<ReportEntry>(); XDocument docToValidate = XDocument.Load(docToValidateStream); var ctx = new DocumentContext(); foreach (ns ns in schema.ns) ctx.AddNamespace(ns.prefix, ns.uri); foreach (Phase phase in phases) { Phase phase1 = phase; foreach ( phase ph in schema.phase.Where( p => p.id != null && p.id.Equals(phase1.ToString(), StringComparison.OrdinalIgnoreCase))) { foreach (active a in ph.active) { pattern pattern = schema.pattern.FirstOrDefault(p => p.id == a.pattern); if (pattern == null) continue; foreach (rule rule in pattern.rule.Where(r => !r.@abstract)) { result.AddRange(ProcessRule(docToValidate, rule, ctx, pattern, ph.id)); } } } } return result; }
public static XElement WhatStyle(string file) { schema sch = schema.Load(file); int g_elds = sch.element.Count; int g_ctds = sch.complexType.Count; int l_elds = (from e in sch.Query.Descendants <localElement>() where e.name != null select e ).Count(); int l_ctds = (from ct in sch.Query.Descendants <localComplexType>() select ct ).Count(); int l_elrs = (from e in sch.Query.Descendants <localElement>() where e.@ref != null select e ).Count(); return(new XElement("style", new XAttribute("file", file), new XAttribute("g_elds", g_elds), new XAttribute("g_ctds", g_ctds), new XAttribute("l_elds", l_elds), new XAttribute("l_elrs", l_elrs), new XAttribute("l_ctds", l_ctds), g_elds > 0 && g_ctds == 0 && l_elds > 0 && l_ctds > 0 && l_elrs == 0 ? "Russian Doll" : g_elds > 0 && g_ctds == 0 && l_elds == 0 && l_ctds > 0 && l_elrs > 0 ? "Salami Slice" : g_ctds > 0 && l_elds > 0 && l_ctds == 0 && l_elrs == 0 ? "Venetian Blind" : g_elds > 0 && g_ctds > 0 && l_elds == 0 && l_ctds == 0 && l_elrs > 0 ? "Garden Of Eden" : "Unknown style" )); }
public static void cerrarConexion(schema.database dbX) { if(db==dbX){ ocupado=false; } else{ dbX.xconnection.Close(); // Cierra la conexión ... dbX.Dispose(); } }
public void Setup() { XmlXsd = schema.Load(@"xml.xsd"); var xmlXsdv1a = new FileInfo(@"xsdschema (ms-visualstudio version).xsd"); var xmlXsdv1b = new FileInfo(@"XMLSchema_v1.xsd"); XsdXsd = schema.Load(xmlXsdv1b); localTestXsd = schema.Load(@"localTest.xsd"); localIncludedXsd = schema.Load(@"localIncluded.xsd"); }
converter = new ApolloServerDataMessageConverter(schema, writer);
public void TestPublicTypeConstruction() { var ncName = new localSimpleType() { restriction = new restriction() { enumeration = { new enumeration(new noFixedFacet() { value = "default" }), new enumeration(new noFixedFacet() { value = "preserve" }) } } }; var xsdExample = new schema() { targetNamespace = new Uri("http://www.w3.org/XML/1998/namespace"), attribute = new List <attribute>() { new attribute(new topLevelAttribute() { name = "base", type = new XmlQualifiedName("anyURI") }), new attribute(new topLevelAttribute() { name = "lang", type = new XmlQualifiedName("language") }), new attribute(new topLevelAttribute() { name = "space", simpleType = ncName }) }, attributeGroup = new List <attributeGroup>() { new attributeGroup(new namedAttributeGroup() { name = "specialAttrs", attribute = { new topLevelAttribute() { @ref = new XmlQualifiedName("base") }, new topLevelAttribute() { @ref = new XmlQualifiedName("lang") }, new topLevelAttribute() { @ref = new XmlQualifiedName("space") }, } }) } }; Assert.DoesNotThrow(() => { xsdExample.lang = "en-GB"; }); var xsdString = xsdExample.ToString(); Assert.DoesNotThrow(() => { schema schema = schema.Parse(xsdString); Assert.IsNotNull(schema.lang as string); }); }
HasSequence( modelBuilder.Model, name, schema, ConfigurationSource.Explicit));
FSMState class: This class has a Dictionary with pairs (Transition-StateID) indicating which new state S2 the FSM should go to when a transition T is fired and the current state is S1. It has methods to add and delete pairs (Transition-StateID), a method to check which state to go to if a transition is passed to it. Two methods are used in the example given to check which transition should be fired (Reason()) and which action(s) (Act()) the GameObject that has the FSMState attached should do. You don't have to use this schema, but some kind of transition - action code must be used in your game.
/// <summary> Build the SDL schema using the GraphQL schema from introspection request using the specified output options. </summary> /// <param name="schema"> GraphQL schema. </param> /// <param name="options"> Output options. </param> /// <returns> SDL schema. </returns> public static string Build(GraphQLSchema schema, SDLBuilderOptions options) => new SDLBuilder(schema, options ?? throw new ArgumentNullException(nameof(options))).Build();
CreateDefaultValue(schema, type.ElementType())
(e, schema, config, codeWriter) => ((EntityContainer)e).WriteEntityContainer(schema, config, codeWriter)), (s => s.EntityTypes, NamespaceFor.EntityType,
(e, schema, config, codeWriter) => ((ComplexType)e).WriteComplexType(schema, config, codeWriter)), (s => s.EntityContainers, NamespaceFor.EntityContainer,