Example #1
0
        public void Test_FromXml_GoodMultiply()
        {
            TestUnitProperty tup = new TestUnitProperty();

            tup.UnitID   = "u3";
            tup.UnitType = UnitTypeCode.Multiply;
            tup.MultiplyMeasures[0].MeasureSchema    = "http://www.aucent.com";
            tup.MultiplyMeasures[0].MeasureNamespace = "myuofm";
            tup.MultiplyMeasures[0].MeasureValue     = "feet";

            tup.MultiplyMeasures[1].MeasureSchema    = "http://www.aucent.com";
            tup.MultiplyMeasures[1].MeasureNamespace = "myuofm";
            tup.MultiplyMeasures[1].MeasureValue     = "feet";

            XmlDocument doc  = new XmlDocument();
            XmlElement  root = doc.CreateElement("xbrl");

            doc.AppendChild(root);

            ArrayList errors = new ArrayList();

            XmlElement unit = null;

            Assert.IsTrue(tup.CreateElement(doc, root, errors, out unit, true));
            Assert.AreEqual(0, errors.Count);
            Assert.IsNotNull(unit);

            root.AppendChild(unit);

            UnitProperty upBack = null;

            Assert.IsTrue(UnitProperty.TryCreateFromXml(unit, null, out upBack, ref errors), errors.Count > 0 ? ((ParserMessage)errors[0]).Message : string.Empty);

            Assert.IsTrue(tup.ValueEquals(upBack), "objects don't match");
        }
Example #2
0
        public Cube(float width, float height, float depth)
        {
            vertics = new UnitProperty[8];

            for (int i = 0; i < vertics.Length; i++)
            {
                vertics[i]       = new UnitProperty();
                vertics[i].Color = new Vector4((float)random.NextDouble(), (float)random.NextDouble(), (float)random.NextDouble(), 1.0f);
            }

            float halfwidth  = 0.5f * width;
            float halfheight = 0.5f * height;
            float halfdepth  = 0.5f * depth;

            vertics[0].Position = new Vector3(-halfwidth, -halfheight, -halfdepth);
            vertics[1].Position = new Vector3(-halfwidth, halfheight, -halfdepth);
            vertics[2].Position = new Vector3(halfwidth, halfheight, -halfdepth);
            vertics[3].Position = new Vector3(halfwidth, -halfheight, -halfdepth);
            vertics[4].Position = new Vector3(-halfwidth, -halfheight, halfdepth);
            vertics[5].Position = new Vector3(-halfwidth, halfheight, halfdepth);
            vertics[6].Position = new Vector3(halfwidth, halfheight, halfdepth);
            vertics[7].Position = new Vector3(halfwidth, -halfheight, halfdepth);

            indices = new uint[36] {
                0, 1, 2, 0, 2, 3, 4, 6, 5, 4, 7, 6,
                4, 5, 1, 4, 1, 0, 3, 2, 6, 3, 6, 7,
                1, 5, 6, 1, 6, 2, 4, 0, 3, 4, 3, 7
            };
        }
Example #3
0
        public void Test_FromXml()
        {
            TestUnitProperty tup = new TestUnitProperty();

            tup.UnitID   = "US_Dollars";
            tup.UnitType = UnitTypeCode.Standard;
            tup.StandardMeasure.MeasureSchema    = "http://www.xbrl.org/2003/iso4217";
            tup.StandardMeasure.MeasureNamespace = "iso4217";
            tup.StandardMeasure.MeasureValue     = "USD";

            XmlDocument doc  = new XmlDocument();
            XmlElement  root = doc.CreateElement("xbrl");

            doc.AppendChild(root);

            ArrayList errors = new ArrayList();

            XmlElement unit = null;

            Assert.IsTrue(tup.CreateElement(doc, root, errors, out unit, true));

            root.AppendChild(unit);

            UnitProperty upBack = null;

            Assert.IsTrue(UnitProperty.TryCreateFromXml(unit, null, out upBack, ref errors), errors.Count > 0 ? ((ParserMessage)errors[0]).Message : string.Empty);

            Assert.IsTrue(tup.ValueEquals(upBack), "objects don't match");
        }
Example #4
0
        public void Test_FromXml_GoodDivide()
        {
            TestUnitProperty tup = new TestUnitProperty();

            tup.UnitID   = "u6";
            tup.UnitType = UnitTypeCode.Divide;
            tup.NumeratorMeasure.MeasureSchema    = "http://www.xbrl.org/2003/iso4217";
            tup.NumeratorMeasure.MeasureNamespace = "iso4217";
            tup.NumeratorMeasure.MeasureValue     = "EUR";

            tup.DenominatorMeasure.MeasureSchema    = "http://www.xbrl.org/2003/instance";
            tup.DenominatorMeasure.MeasureNamespace = "xbrli";
            tup.DenominatorMeasure.MeasureValue     = "shares";

            XmlDocument doc  = new XmlDocument();
            XmlElement  root = doc.CreateElement("xbrl");

            doc.AppendChild(root);

            ArrayList errors = new ArrayList();

            XmlElement unit = null;

            Assert.IsTrue(tup.CreateElement(doc, root, errors, out unit, true), "element not created");
            Assert.AreEqual(0, errors.Count, "errors returned");
            Assert.IsNotNull(unit, "unit is null");

            root.AppendChild(unit);

            UnitProperty upBack = null;

            Assert.IsTrue(UnitProperty.TryCreateFromXml(unit, null, out upBack, ref errors), errors.Count > 0 ? ((ParserMessage)errors[0]).Message : string.Empty);

            Assert.IsTrue(tup.ValueEquals(upBack), "objects don't match");
        }
Example #5
0
        public static string GetCurrencyCodeFromUnit(UnitProperty up)
        {
            if (up == null)
            {
                return(string.Empty);
            }

            string code = string.Empty;

            if (up.UnitType == UnitProperty.UnitTypeCode.Standard && up.StandardMeasure.MeasureSchema.Contains("4217"))
            {
                code = up.StandardMeasure.MeasureValue;
            }
            else if (up.UnitType == UnitProperty.UnitTypeCode.Divide && up.NumeratorMeasure != null && up.NumeratorMeasure.MeasureSchema.Contains("4217"))
            {
                code = up.NumeratorMeasure.MeasureValue;
            }

            if (code == null)
            {
                return(string.Empty);
            }

            code = code.Trim().ToUpper();
            return(code);
        }
    //for opporane
    void CheckAttack(UnitProperty coll_Unit)
    {
        if (coll_Unit.gameObject.tag == "Unit")
        {
            //hit the units are face to face
            enableRigidKinematic();
//			Debug.Log(" get object " + coll_Unit.gameObject.name +  "is  trigger entered ");
            if (coll_Unit != null)
            {
                float distance = GetComponent <AngleProvidor>().GetCurrentDistance();
                //				Debug.Log(" check attack distance - how far between target ? " + distance + " / " + (attack_radius/2) );
                if (getIsReadyToAttack() && distance < attack_radius / 2)
                {
                    //set my healthPoint
                    doNormalAttack(coll_Unit.GetComponent <KnockBackHelper>(), coll_Unit);
                }

                if (coll_Unit.getIsReadyToAttack())
                {
//					Debug.Log("wiil receive unit("+ coll_Unit.gameObject.name+ ") attack");
                }
            }
        }
        else if (coll_Unit.gameObject.tag == "Item")
        {
            //hit the unit not face to this Unit
            disableRigidKinematic();
        }
        else
        {
        }
    }
    void OnTriggerEnter(Collider collision)
    {
        if (collision.gameObject.tag == "Unit" || collision.gameObject.tag == "PlayerUnit")
        {
            GameObject.Destroy(gameObject);

            UnitProperty coll_Unit = collision.gameObject.GetComponent <UnitProperty>();
            if (coll_Unit != null)
            {
                switch (type)
                {
                case ItemType.heath:
                    coll_Unit.addHealthPoint(value);
                    break;

                case ItemType.poison:
                    coll_Unit.addHealthPoint(-value);
                    break;

                case ItemType.power:
                    coll_Unit.setPowerBuffWithDuration(value, value_duration);
                    break;
                }
            }

            Debug.Log("Unit & PlayerUnit collied");
        }
    }
Example #8
0
        public static bool IsCustomUnit(UnitProperty up)
        {
            if (up == null)
            {
                return(false);
            }

            if (up.StandardMeasure == null ||
                string.IsNullOrEmpty(up.StandardMeasure.MeasureValue))
            {
                return(false);
            }

            if (up.UnitType != UnitProperty.UnitTypeCode.Standard)
            {
                return(false);
            }

            if (InstanceReportColumn.IsPureUnit(up) ||
                InstanceReportColumn.IsSharesUnit(up) ||
                InstanceReportColumn.IsMonetaryUnit(up))
            {
                return(false);
            }

            return(true);
        }
Example #9
0
    public void touchedUnit(GameObject unit, UnitProperty component)
    {
        if (unit != null && component != null)
        {
            UnitProperty.UnitType in_type = component.type_init;
            if (in_type == UnitProperty.UnitType.PlayerSupport)
            {
                GameObject curPlayerUnit;

                //do selected Player unit change
                if (playerUnits.Count > 1)
                {
                    foreach (GameObject listunit in playerUnits.ToArray())
                    {
                        if (listunit.GetComponent <UnitProperty>().type_init == UnitProperty.UnitType.Player)
                        {
                            curPlayerUnit = listunit;
                        }
                    }
                }
                else
                {
                    //do nothing as no more unit able to swtich
                }
            }
            else if (in_type == UnitProperty.UnitType.AI)
            {
            }
        }
    }
Example #10
0
 public void Init(int id, string name, string avator, UnitProperty val, UnitProperty percent)
 {
     Id      = id;
     Name    = name;
     Avator  = avator;
     Val     = val;
     Percent = percent;
 }
Example #11
0
 public MergedContextUnitsWrapper(string keyName, ContextProperty cp, UnitProperty up)
     : this(keyName, cp)
 {
     if (up != null)
     {
         this.UPS.Add(up);
     }
 }
Example #12
0
 /// <summary>
 /// Create a new <see cref="EmbeddedUnitWrapper"/> with the given
 /// values.
 /// </summary>
 /// <param name="up">The underlying unit property.</param>
 /// <param name="otherUPs">Other unit properties.</param>
 public EmbeddedUnitWrapper(UnitProperty up, List <UnitProperty> otherUPs)
 {
     this.UnderlyingUnitProperty = up;
     this.OtherUnits             = new List <UnitProperty>(otherUPs);
     if (OtherUnits.Contains(this.UnderlyingUnitProperty))
     {
         OtherUnits.Remove(this.UnderlyingUnitProperty);
     }
 }
Example #13
0
        private UnitProperty CreateStandardUnit(string id, int scale, string ns, string schema, string val)
        {
            UnitProperty up = new UnitProperty(id, UnitProperty.UnitTypeCode.Standard);

            up.Scale = scale;
            up.StandardMeasure.MeasureNamespace = ns;
            up.StandardMeasure.MeasureSchema    = schema;
            up.StandardMeasure.MeasureValue     = val;
            return(up);
        }
Example #14
0
        private void PopulateNumeric()
        {
            Element.PeriodType periodType = Element.PeriodType.duration;
            element               = new Node(Element.CreateMonetaryElement("test", false, Element.BalanceType.credit, periodType));
            contextRef            = new ContextProperty();
            contextRef.PeriodType = periodType;

            unitRef = new UnitProperty();

            markupData = "-123.12";
        }
Example #15
0
    protected bool GivePropertyTo(GameObject obj, UnitProperty giveProperty, bool updateInfoIfPropertyExists)
    {
        PropertyManager objPropertyManager = obj.GetComponent <PropertyManager>();

        if (objPropertyManager == null)
        {
            Debug.Log(CanNotFindPropertyManagerSoAddOne(obj));
            objPropertyManager = obj.AddComponent <PropertyManager>();
        }
        return(objPropertyManager.ApplyProperty(giveProperty, updateInfoIfPropertyExists));
    }
Example #16
0
        public void Equals()
        {
            const string error = "Failure to correctly compare UnitProperty";
            UnitProperty unitProperty0 = new UnitProperty();
            unitProperty0.UnitID= "unitProperty0";
            Assert.AreEqual(true, unitProperty0.Equals(unitProperty0), error);

            UnitProperty unitProperty1 = new UnitProperty();
            unitProperty1.UnitID= "unitProperty1";
            Assert.AreEqual(false, unitProperty0.Equals(unitProperty1), error);
            Assert.AreEqual(true, unitProperty0.ValueEquals(unitProperty1), error);
        }
Example #17
0
 public UnitProperty[] GetPropertyList()
 {
     if (propertyList.Count == 0)
     {
         return(null);
     }
     UnitProperty[] list = new UnitProperty[propertyList.Count];
     for (int i = 0; i < propertyList.Count; i++)
     {
         list[i] = propertyList[i];
     }
     return(list);
 }
Example #18
0
        private async Task <ImmutableDictionary <BodyPartIndex, Wound> > HitCalculateWithoutInjurantAsync(
            IEntity attacker,
            IEntity defender,
            HitMethod hitMethod)
        {
            UnitState attackerState = await GrainFactory.Get <IUnit>(attacker).GetData();

            UnitState defenderState = await GrainFactory.Get <IUnit>(defender).GetData();

            UnitProperty hitRate;
            UnitProperty dodgeRate = defenderState.DodgeRate;
            UnitProperty attackEfficiency;

            switch (hitMethod)
            {
            case HitMethod.Fist:
                hitRate          = attackerState.UpperAttackHitRate;
                attackEfficiency = attackerState.UpperAttackEfficiency;

                break;

            case HitMethod.Foot:
                hitRate          = attackerState.LowerAttackHitRate;
                attackEfficiency = attackerState.LowerAttackEfficiency;

                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(hitMethod), hitMethod, null);
            }

            double hitP = 1 - Math.Exp(hitRate / dodgeRate);

            if (Rand.NextDouble() > hitP)
            {
                return(ImmutableDictionary <BodyPartIndex, Wound> .Empty);
            }

            var attackResult = new Dictionary <BodyPartIndex, Wound>();

            for (var i = 0; i < (int)BodyPartIndex.BodyPartCount; i++)
            {
                if (Options.BodyHitBaseProbability[i] > Rand.NextDouble())
                {
                    attackResult.Add((BodyPartIndex)i, new Wound((uint)attackEfficiency, WoundType.Bruise));
                }
            }

            return(attackResult.ToImmutableDictionary());
        }
Example #19
0
        public void Equals()
        {
            const string error         = "Failure to correctly compare UnitProperty";
            UnitProperty unitProperty0 = new UnitProperty();

            unitProperty0.UnitID = "unitProperty0";
            Assert.AreEqual(true, unitProperty0.Equals(unitProperty0), error);

            UnitProperty unitProperty1 = new UnitProperty();

            unitProperty1.UnitID = "unitProperty1";
            Assert.AreEqual(false, unitProperty0.Equals(unitProperty1), error);
            Assert.AreEqual(true, unitProperty0.ValueEquals(unitProperty1), error);
        }
Example #20
0
        public static bool IsSharesUnit(UnitProperty up)
        {
            if (up == null)
            {
                return(false);
            }

            if (up.UnitType == UnitProperty.UnitTypeCode.Standard &&
                string.Equals(up.StandardMeasure.MeasureValue, "shares", StringComparison.CurrentCultureIgnoreCase))
            {
                return(true);
            }

            return(false);
        }
Example #21
0
        public static bool IsMonetaryUnit(UnitProperty up)
        {
            if (up == null)
            {
                return(false);
            }

            if (up.UnitType == UnitProperty.UnitTypeCode.Standard &&
                string.Equals(up.StandardMeasure.MeasureNamespace, InstanceUtils.CURRENCY_NAMESPACE, StringComparison.CurrentCultureIgnoreCase))
            {
                return(true);
            }

            return(false);
        }
Example #22
0
        public BlobHandler(T owner)
        {
            _owner = owner;

            var blobLevelLow = new UnitProperty(_owner, AggregateField.blob_level_low, AggregateField.blob_level_low_modifier);

            _owner.AddProperty(blobLevelLow);

            var blobLevelHigh = new UnitProperty(_owner, AggregateField.blob_level_high, AggregateField.blob_level_high_modifier);

            _owner.AddProperty(blobLevelHigh);

            _blobEffect = new BlobEffectProperty(_owner, () => _blobLevel, () => blobLevelLow.Value, () => blobLevelHigh.Value);
            _owner.AddProperty(_blobEffect);
        }
Example #23
0
        public static bool IsExchangeRateUnit(UnitProperty up)
        {
            if (up == null)
            {
                return(false);
            }

            //currency / currency = "exchangeRate"
            if (up.UnitType == UnitProperty.UnitTypeCode.Divide &&
                string.Equals(up.NumeratorMeasure.MeasureNamespace, InstanceUtils.CURRENCY_NAMESPACE, StringComparison.CurrentCultureIgnoreCase) &&
                string.Equals(up.DenominatorMeasure.MeasureNamespace, InstanceUtils.CURRENCY_NAMESPACE, StringComparison.CurrentCultureIgnoreCase))
            {
                return(true);
            }

            return(false);
        }
Example #24
0
        protected override void OnProcessUnit(ref UnitProperty unitProperty, object vertex, params object[] inputData)
        {
            var node = (vertex as UnitProperty);

            var worldMatrix   = (Matrix4x4)inputData[0];
            var cameraMatrix  = (Matrix4x4)inputData[1];
            var projectMatrix = (Matrix4x4)inputData[2];

            Debug.Assert(node != null, nameof(node) + " != null");

            unitProperty.Color               = node.Color;
            unitProperty.Position            = node.Position;
            unitProperty.PositionTransformed = new Vector4(node.Position, 1.0f);

            unitProperty.PositionTransformed = Vector4.Transform(unitProperty.PositionTransformed, worldMatrix);
            unitProperty.PositionTransformed = Vector4.Transform(unitProperty.PositionTransformed, cameraMatrix);
            unitProperty.PositionTransformed = Vector4.Transform(unitProperty.PositionTransformed, projectMatrix);
        }
    void OnTriggerEnter(Collider collision)
    {
        if (collision.gameObject.tag == "Unit" ||
            collision.gameObject.tag == "UnitPointer" ||
            collision.gameObject.tag == "PlayerUnit")
        {
            removeiTweenComponent();

            UnitProperty coll_Unit = collision.GetComponent <UnitProperty>();
            if (coll_Unit != null)
            {
                CheckAttack(coll_Unit);
            }
        }
        else if (collision.gameObject.tag == "wall")
        {
//			removeiTweenComponent();
//			moveEnd();
        }
    }
Example #26
0
            private IParameterDescriptor[] GetParameterArray(IParameterDescriptor parameter)
            {
                if (!UnitProperty.TryGet(parameter.Metadata, out var unit) || Equals(unit, DefaultUnit))
                {
                    return(DefaultParameters);
                }
                if (_cache.TryGetValue(parameter, out var cachedParameters))
                {
                    return(cachedParameters);
                }
                var metadata = new Context {
                    [UnitProperty] = unit
                };
                var parameters = new IParameterDescriptor[]
                {
                    new MetadataOverridenParameter(Width, metadata),
                    new MetadataOverridenParameter(Height, metadata)
                };

                _cache.Add(parameter, parameters);
                return(parameters);
            }
    void doNormalAttack(KnockBackHelper target_knockBackHelper, UnitProperty coll_Unit)
    {
        //set explosion
        if (target_knockBackHelper != null)
        {
            power = getCurrentPower();
            Debug.Log("(" + gameObject.name + ") hit Unit (" + coll_Unit.gameObject.name + ") knockBack with power " + power);

            //knock back
            target_knockBackHelper.doExplodionKnockBackWithTween(gameObject, power);

            //lost health point
            coll_Unit.addHealthPoint(-getCurrentPower());

            //set Attack
            isReadyToAttack = false;
        }
        else
        {
            Debug.Log("knockback not found");
        }
    }
    public void moveEnd()
    {
//		disableRigidKinematic();
//		Debug.Log("("+gameObject.name+") moveEnd" );
        GameObject target = gameObject.GetComponent <AngleProvidor>().GetClosestUnit();

        if (target != null)
        {
            UnitProperty coll_Unit = target.GetComponent <UnitProperty>();
            if (coll_Unit != null)
            {
                CheckAttack(coll_Unit);
            }
        }
        else
        {
            Debug.Log("get no target in range");
        }

        if (type_init == UnitType.AI || type_init == UnitType.PlayerSupport)
        {
            onMove_AI = false;
        }
    }
        private static void CreateBuffer()
        {
            vertices = new UnitProperty[3];


            vertices[0] = new UnitProperty();
            vertices[1] = new UnitProperty();
            vertices[2] = new UnitProperty();

            vertices[0].Position = new Vector3(0, 0, 0);
            vertices[1].Position = new Vector3(5, 0, 0);
            vertices[2].Position = new Vector3(0, 5, 0);

            vertices[0].Color = new Vector4(1, 0, 0, 1);
            vertices[1].Color = new Vector4(0, 1, 0, 1);
            vertices[2].Color = new Vector4(0, 0, 1, 1);


            indices = new uint[36] {
                0, 1, 2, 0, 2, 3, 4, 6, 5, 4, 7, 6,
                4, 5, 1, 4, 1, 0, 3, 2, 6, 3, 6, 7,
                1, 5, 6, 1, 6, 2, 4, 0, 3, 4, 3, 7
            };

            cube = new Cube(3, 3, 3);

            camera.Position = new Vector3(0, 0, 10);
            camera.LookAt   = new Vector3(0, 0, 0);

            matrix = new object[3];

            matrix[0] = Matrix4x4.CreateTranslation(new Vector3(0, 0, 0));
            matrix[1] = Matrix4x4.CreateLookAt(camera.Position, camera.LookAt, new Vector3(0, 1, 0));
            matrix[2] = Matrix4x4.CreatePerspectiveFieldOfView((float)Math.PI * 0.55f,
                                                               Program.Size.Width / (float)Program.Size.Height, 1.0f, 2000.0f);
        }
Example #30
0
        private static GlobalTechInfo ParseTechValues(List <List <string> > techValues)
        {
            // Process tech header
            string techName = techValues[0][1];

            int techId;

            if (!int.TryParse(techValues[0][2], out techId))
            {
                Debug.LogError("Tech '" + techName + "' has an invalid tech Id!");
            }

            TechCategory            category        = TechCategory.Basic;
            string                  description     = "";
            string                  teaser          = "";
            string                  improveDesc     = "";
            int                     edenCost        = 0;
            int                     plymouthCost    = 0;
            int                     maxScientists   = 0;
            LabType                 labType         = LabType.Standard;
            List <int>              requiredTechIDs = new List <int>();
            List <UnitPropertyInfo> unitProperties  = new List <UnitPropertyInfo>();


            // Process tech values
            for (int i = 0; i < techValues.Count; ++i)
            {
                if (techValues[i].Count < 2)
                {
                    Debug.LogError("TechID " + techId + ": Not enough values specified for type: " + techValues[i][0]);
                    continue;
                }

                int value;
                int.TryParse(techValues[i][1], out value);

                switch (techValues[i][0])
                {
                case "CATEGORY":                        category = (TechCategory)value;         break;

                case "DESCRIPTION":                     description = techValues[i][1];         break;

                case "TEASER":                          teaser = techValues[i][1];                      break;

                case "IMPROVE_DESC":            improveDesc = techValues[i][1];         break;

                case "REQUIRES":                        requiredTechIDs.Add(value);                     break;

                case "COST":                            edenCost = plymouthCost = value;        break;

                case "EDEN_COST":                       edenCost = value;                                       break;

                case "PLYMOUTH_COST":           plymouthCost = value;                           break;

                case "MAX_SCIENTISTS":          maxScientists = value;                          break;

                case "LAB":                                     labType = (LabType)value;                       break;

                case "UNIT_PROP":
                    if (techValues[i].Count < 4)
                    {
                        Debug.LogError("TechID " + techId + ": Not enough values specified for type: " + techValues[i][0]);
                        continue;
                    }

                    map_id mapId = SheetReader.GetMapIdFromCodeName(techValues[i][1]);
                    if (mapId == map_id.None)
                    {
                        Debug.LogError("TechID " + techId + ": Bad unit specifier: " + techValues[i][1]);
                        break;
                    }

                    UnitProperty property = GetUnitProperty(techValues[i][2]);
                    if (property == UnitProperty.None)
                    {
                        Debug.LogError("TechID " + techId + ": Bad property specifier: " + techValues[i][2]);
                        break;
                    }

                    int.TryParse(techValues[i][3], out value);

                    unitProperties.Add(new UnitPropertyInfo(mapId, property, value));

                    break;
                }
            }

            return(new GlobalTechInfo(techId, category, plymouthCost, edenCost, maxScientists, labType, techName, description, teaser, improveDesc, requiredTechIDs, unitProperties));
        }
Example #31
0
        public void CreateFromXml()
        {
            string startXml =
                @"<?xml version=""1.0"" encoding=""utf-16""?>
<!--Blah Blah Blah-->
<!--Based on XBRL 2.1-->
<!--Blah Blah Blah-->
<xbrl xmlns=""http://www.xbrl.org/2003/instance"" xmlns:link=""http://www.xbrl.org/2003/linkbase"" xmlns:xlink=""http://www.w3.org/1999/xlink"" xmlns:usfr_pt=""http://www.xbrl.org/2003/usfr"" xmlns:iso4217=""http://www.xbrl.org/2003/iso4217"">
  <link:schemaRef xlink:type=""simple"" xlink:href=""test.xsd"" />
  <!--Context Section-->
  <context id=""current_AsOf"">
    <entity>
      <identifier scheme=""http://www.rivetsoftware.com"">Rivet</identifier>
    </entity>
    <period>
      <instant>2003-12-31</instant>
    </period>
  </context>
  <!--Unit Section-->
  <unit id=""u1"">
    <!--Scale: 0-->
    <measure>iso4217:USD</measure>
  </unit>
  <unit id=""u2"">
    <!--Scale: 3-->
    <measure>iso4217:USD</measure>
  </unit>
  <!--Tuple Section-->
  <usfr_pt:tupleParent1>
    <!--Tuple Set Name: set1-->
    <!--Document address: Excel - Sheet1!$A$2-->
    <usfr_pt:element2 contextRef=""current_AsOf"" unitRef=""u2"" decimals=""10"">98765000</usfr_pt:element2>
    <!--Tuple Set Name: set1-->
    <!--Document address: Excel - Sheet1!$A$1-->
    <usfr_pt:element1 contextRef=""current_AsOf"" unitRef=""u1"" decimals=""10"">12345</usfr_pt:element1>
  </usfr_pt:tupleParent1>
</xbrl>";

            XmlDocument xDoc = new XmlDocument();

            xDoc.LoadXml(startXml);

            XmlNamespaceManager theManager = new XmlNamespaceManager(xDoc.NameTable);

            theManager.AddNamespace("link2", "http://www.xbrl.org/2003/instance");
            theManager.AddNamespace("usfr_pt", "http://www.xbrl.org/2003/usfr");

            ContextProperty cp = new ContextProperty("current_AsOf");

            cp.EntityValue     = "Rivet";
            cp.EntitySchema    = "http://www.rivetsoftware.com";
            cp.PeriodType      = Element.PeriodType.instant;
            cp.PeriodStartDate = new DateTime(2003, 12, 31);

            ArrayList contexts = new ArrayList( );

            contexts.Add(cp);

            UnitProperty up = new UnitProperty("u1", UnitProperty.UnitTypeCode.Standard);

            up.StandardMeasure.MeasureNamespace = "iso4217";
            up.StandardMeasure.MeasureSchema    = "http://www.xbrl.org/2003/iso4217";
            up.StandardMeasure.MeasureValue     = "USD";

            ArrayList units = new ArrayList();

            units.Add(up);

            UnitProperty up2 = new UnitProperty("u2", UnitProperty.UnitTypeCode.Standard);

            up2.StandardMeasure.MeasureNamespace = "iso4217";
            up2.StandardMeasure.MeasureSchema    = "http://www.xbrl.org/2003/iso4217";
            up2.StandardMeasure.MeasureValue     = "USD";

            units.Add(up2);

            XmlNodeList elemList = xDoc.SelectNodes("//usfr_pt:tupleParent1", theManager);

            Assert.IsNotNull(elemList, "elem not found");
            Assert.AreEqual(1, elemList.Count, "elem count is wrong");

            TupleSet  ts = null;
            ArrayList tupleMarkups;
            ArrayList errors = new ArrayList();

            TupleSet.TryCreateFromXml(elemList[0], contexts, units, out ts, out tupleMarkups, ref errors);



            Assert.AreEqual(2, tupleMarkups.Count, "wrong number of elements returned");
            Assert.AreEqual(2, ts.Children.Count, "wrong number of elements returned");
        }