public void ShouldAcceptFieldFormatHeppHopp() { BooleanDataType dataType = new BooleanDataType("hepp/hopp"); dataType.GetTrue().Should().Be("hepp"); dataType.GetFalse().Should().Be("hopp"); }
protected override void DoRun(Field field) { string value = field.Value; DataType dt = field.Definition.Type; if (dt.GetType() != typeof(BooleanDataType)) { return; } BooleanDataType dataType = (BooleanDataType)dt; if (dataType.IsValid(value)) { return; } // value is illegal boolean value FieldIndex fieldIndeks = field.Definition.GetIndex(); if (!_nonBooleanValues.ContainsKey(fieldIndeks)) { _nonBooleanValues.Add(fieldIndeks, new HashSet <string>()); } _nonBooleanValues[fieldIndeks].Add(value); }
public void ShouldAcceptFieldFormatTF() { BooleanDataType dataType = new BooleanDataType("T/F"); dataType.GetTrue().Should().Be("T"); dataType.GetFalse().Should().Be("F"); }
public void ShouldAcceptFieldFormatYN() { BooleanDataType dataType = new BooleanDataType("Y/N"); dataType.GetTrue().Should().Be("Y"); dataType.GetFalse().Should().Be("N"); }
public void IsNullShouldReturnTrueIfStringIsEqualToNullValue() { BooleanDataType type = new BooleanDataType("T/F", new List <string> { "null", "" }); type.IsNull("null").Should().BeTrue(); type.IsNull("").Should().BeTrue(); }
public Request(Request request) { this._returnPolicyIdList = request._returnPolicyIdList; this._combinedDecision = request._combinedDecision; this._otherattributes = request._otherattributes; this._attributes = new List <Attributes>(request._attributes); this._requestDefaults = new List <RequestDefaults>(request._requestDefaults); this._multiRequests = new List <MultiRequests>(request._multiRequests); }
public void IsNullShouldReturnFalseIfStringIsNotEqualToNullValue() { BooleanDataType type = new BooleanDataType("T/F", new List <string> { "null", "" }); type.IsNull("T").Should().BeFalse(); type.IsNull("F").Should().BeFalse(); type.IsNull("other").Should().BeFalse(); }
public void IsNullShouldReturnFalseIfNullValueIsNotSet() { BooleanDataType type = new BooleanDataType("T/F", null); type.IsNull("null").Should().BeFalse(); type.IsNull("").Should().BeFalse(); type.IsNull("T").Should().BeFalse(); type.IsNull("F").Should().BeFalse(); type.IsNull("other").Should().BeFalse(); }
/// <summary> /// Initializes static members of the DataTypes class. /// </summary> static DataTypes() { Integer = new IntegerDataType(); Stream = new StreamDataType(); String = new StringDataType(); Boolean = new BooleanDataType(); FixedPoint = new FixedPointDataType(); FloatingPoint = new FloatingPointDataType(); DateTime = new DateTimeDataType(); Binary = new BinaryDataType(); Guid = new GuidDataType(); TimeOfDay = new TimeOfDayDataType(); ComplexType = new ComplexDataType(); EntityType = new EntityDataType(); CollectionType = new CollectionDataType(); ReferenceType = new ReferenceDataType(); RowType = new RowDataType(); EnumType = new EnumDataType(); Spatial = new SpatialDataType(); }
static DataTypeDescriptor() { DnsName = new DnsNameDataType(); IpAddress = new IpAddress(); Bag = new Bag(); Time = new Time(); String = new StringDataType(); Rfc822Name = new Rfc822Name(); X500Name = new X500Name(); Double = new DoubleDataType(); YearMonthDuration = new YearMonthDuration(); DaytimeDuration = new DaytimeDuration(); DateTime = new DateTime(); Date = new DateDataType(); Integer = new IntegerDataType(); Boolean = new BooleanDataType(); HexBinary = new HexBinary(); Base64Binary = new Base64Binary(); AnyUri = new AnyUri(); Function = new FunctionDataType(); }
public DataTypeValue GetInstance(Node node) { return(BooleanDataType.GetInstance(node)); }
public DataTypeValue GetInstance(string value) { return(BooleanDataType.GetInstance(value)); }
IEdmPrimitiveTypeReference IPrimitiveDataTypeVisitor <IEdmPrimitiveTypeReference> .Visit(BooleanDataType dataType) { return(this.GetFacetlessEdmTypeReference(dataType)); }
public Request(Node node) { if (node.NodeName.Equals(Identifer) == false) { throw new Indeterminate(Indeterminate.IndeterminateSyntaxError); } this._otherattributes = new Hashtable(); NamedNodeMap attrs = node.Attributes; this._combinedDecision = BooleanDataType.False; for (int i = 0; i < attrs.Length; i++) { Node child = attrs.Item(i); if (child.NodeName.Equals("ReturnPolicyIdList")) { string value = node.Attributes.GetNamedItem("ReturnPolicyIdList").NodeValue.Trim(); if (value.EqualsIgnoreCase("true")) { this._returnPolicyIdList = BooleanDataType.True; } else { this._returnPolicyIdList = BooleanDataType.False; } } else if (child.NodeName.Equals("CombinedDecision")) { string value = node.Attributes.GetNamedItem("CombinedDecision").NodeValue.Trim(); if (value.EqualsIgnoreCase("true")) { this._combinedDecision = BooleanDataType.True; } else { this._combinedDecision = BooleanDataType.False; } } else { this._otherattributes.Add(child.NodeName, child.NodeValue); } } this._attributes = new List <Attributes>(); this._requestDefaults = new List <RequestDefaults>(); this._multiRequests = new List <MultiRequests>(); NodeList children = node.ChildNodes; for (int i = 0; i < children.Length; i++) { Node child = children.Item(i); if (child.NodeName.Equals(Attributes.Identifer)) { this._attributes.Add(Attributes.GetInstance(child)); } else if (child.NodeName.Equals(RequestDefaults.Identifer)) { this._requestDefaults.Add(new RequestDefaults(child)); } else if (child.NodeName.Equals(MultiRequests.Identifer)) { this._multiRequests.Add(new MultiRequests(child)); } } }
public Attribute(Node node) { if (!node.NodeName.Equals(Identifer)) { throw new Indeterminate(Indeterminate.IndeterminateSyntaxError); } NamedNodeMap attributes = node.Attributes; Node idnode = attributes.GetNamedItem("AttributeId"); if (idnode != null) { this._attributeId = new AnyURIDataType(idnode.NodeValue); } else { throw new Indeterminate(Indeterminate.IndeterminateSyntaxError); } Node includeinresultnode = attributes.GetNamedItem("IncludeInResult"); if (includeinresultnode != null) { string value = includeinresultnode.NodeValue.Trim(); if (value.EqualsIgnoreCase("true")) { this._includeInResult = BooleanDataType.True; } else { this._includeInResult = BooleanDataType.False; } } else { throw new Indeterminate(Indeterminate.IndeterminateSyntaxError); } Node issuernode = attributes.GetNamedItem("Issuer"); if (issuernode != null) { this._issuer = new StringDataType(issuernode.NodeValue); } this._attributeValues = new List <AttributeValue>(); NodeList children = node.ChildNodes; for (int i = 0; i < children.Length; i++) { Node child = children.Item(i); if (child.NodeName.Equals("AttributeValue")) { this._attributeValues.Add((AttributeValue)AttributeValue.GetInstance(child)); } } if (this._attributeValues.Count == 0) { throw new Indeterminate(Indeterminate.IndeterminateSyntaxError); } }
/// <summary> /// Resolves the specified data type. /// </summary> /// <param name="dataType">Data type specification.</param> /// <returns>Resolved EDM Type.</returns> PrimitiveDataType IPrimitiveDataTypeVisitor <PrimitiveDataType> .Visit(BooleanDataType dataType) { return(EdmDataTypes.Boolean); }
public virtual void VisitBooleanDataType(BooleanDataType booleanDataType) { DefaultVisit(booleanDataType); }