Exemplo n.º 1
0
        private static IFeatureWorkspace CreateTestWorkspace(
            [NotNull] string fgdbName,
            [NotNull] string fcName, [NotNull] string tableName, [NotNull] string relClassName,
            [NotNull] out IFeatureClass fc,
            [NotNull] out ITable table,
            [NotNull] out IRelationshipClass rc)
        {
            IFeatureWorkspace ws = TestWorkspaceUtils.CreateTestFgdbWorkspace(fgdbName);

            ISpatialReference sref = SpatialReferenceUtils.CreateSpatialReference(
                (int)esriSRProjCS2Type.esriSRProjCS_CH1903Plus_LV95, true);

            fc = DatasetUtils.CreateSimpleFeatureClass(
                ws, fcName, null,
                FieldUtils.CreateOIDField(),
                FieldUtils.CreateIntegerField("FKEY"),
                FieldUtils.CreateShapeField(
                    "SHAPE", esriGeometryType.esriGeometryPoint,
                    sref, 1000));

            table = DatasetUtils.CreateTable(ws, tableName,
                                             FieldUtils.CreateOIDField(),
                                             FieldUtils.CreateTextField("TEXT", 100));

            rc = TestWorkspaceUtils.CreateSimple1NRelationship(
                ws, relClassName,
                table, (ITable)fc,
                table.OIDFieldName, "FKEY");

            return(ws);
        }
        protected override void InitializeWorkerMain()
        {
            if (!WorkerSettings.TryGetValue("OutputFolder", out OutputFolder))
            {
                throw new ArgumentException("Missing argument 'OutputFolder'");
            }

            if (!WorkerSettings.TryGetValue("ConfigFileName", out string configFileName))
            {
                throw new ArgumentException("Missing argument 'ConfigFileName'");
            }

            if (!WorkerSettings.TryGetValue("PluginId", out string pluginId))
            {
                throw new ArgumentException("Missing argument 'PluginId'");
            }

            this.Fields = FieldUtils.GetFieldsFromXml(configFileName, pluginId).ToList();

            if (!Directory.Exists(OutputFolder))
            {
                Directory.CreateDirectory(OutputFolder);
            }

            this.GlobalStorage = this.Runtime.GetWorkspaceDocsStorage(this.Runtime.CurrentWorkspace.ID);
        }
Exemplo n.º 3
0
		private ITable CreateTable([NotNull] string name,
		                           [NotNull] string urlFieldName)
		{
			return DatasetUtils.CreateTable(_testWs, name,
			                                FieldUtils.CreateOIDField(),
			                                FieldUtils.CreateTextField(urlFieldName, 500));
		}
Exemplo n.º 4
0
		public void CanCheckOnlyDistinctUrls()
		{
			const string urlRoot = "http://localhost:8080/";
			const string urlInfixExisting = "test/";
			const string existingPrefix = urlRoot + urlInfixExisting;
			const string helloWorldHtml = "hello_world.html";
			const string urlFieldName = "URL_SUFFIX";

			var objectClass = new ObjectClassMock(1, "testtable");
			objectClass.AddField(FieldUtils.CreateTextField(urlFieldName, 500));

			int urlFieldIndex = objectClass.FindField(urlFieldName);
			Assert.IsTrue(urlFieldIndex >= 0);

			IObject rowWithExistingUrl = CreateRow(objectClass, 1, urlFieldIndex,
			                                       helloWorldHtml);

			string urlExpression = $"'{existingPrefix}' + [{urlFieldName}]";

			var errorCount = 0;
			using (var webServer = new WebServer(SendHeadResponse, existingPrefix))
			{
				webServer.Run();

				var test = new QaValidUrls(objectClass, urlExpression);
				var runner = new QaTestRunner(test);

				errorCount += runner.Execute(rowWithExistingUrl);
				errorCount += runner.Execute(rowWithExistingUrl);
				errorCount += runner.Execute(rowWithExistingUrl);
			}

			Assert.AreEqual(0, errorCount);
			Assert.AreEqual(1, _webRequestCounts);
		}
Exemplo n.º 5
0
        /// <summary>
        /// Determines whether the output is valid.
        /// </summary>
        /// <returns></returns>
        protected override ValidatorResult Evaluate()
        {
            string controlValidationValue = base.ControlValidationValue;

            decimal decimalValue;

            if (decimal.TryParse(controlValidationValue, out decimalValue))
            {
                if (decimalValue >= 0)
                {
                    if (decimalValue.Equals(Math.Round(decimalValue, 2)))
                    {
                        return(ValidatorResult.Valid);
                    }
                }
            }

            Database master = Sitecore.Configuration.Factory.GetDatabase("master");

            Item messageItem = master.GetItem(MessageReferences.MessageInvalidCurrencyItem);

            base.Text = FieldUtils.GetFieldValue(messageItem, References.Keys.SimpleTextFieldName);

            return(GetMaxValidatorResult());
        }
Exemplo n.º 6
0
        private void GetMessageID()
        {
            bool allow = false;

            foreach (var i in (FieldUtils.GetModuleFields(
                                   ModuleInfo.ModuleID,
                                   //CODES.DEFMODFLD.FLDGROUP.COMMON)))
                                   CODES.DEFMODFLD.FLDGROUP.PARAMETER)))
            {
                if (i.FieldName == "MESSAGEID")
                {
                    allow = true;
                }
            }


            if (allow)
            {
                var field = FieldUtils.GetModuleFieldByName(
                    ModuleInfo.ModuleID,
                    //CODES.DEFMODFLD.FLDGROUP.COMMON,
                    CODES.DEFMODFLD.FLDGROUP.PARAMETER,
                    "MESSAGEID");

                var value = this[field.FieldID];
                if (value != null)
                {
                    Program.StrMessageID = value.ToString();
                }
            }
        }
    private void DoBattingAction(BallController ballControllerScript, PlayerStatus playerStatusScript, float pitchSuccesRate)
    {
        PlayersTurnManager playersTurnManager = GameUtils.FetchPlayersTurnManager();

        if (!ActionCalculationUtils.HasActionSucceeded(pitchSuccesRate))
        {
            this.EquipedBat.GetComponent <CapsuleCollider2D>().enabled = false;
            ballControllerScript.IsPitched = false;
            ballControllerScript.IsHit     = true;
            GameObject        homeBase         = GameUtils.FetchBaseGameObject(TagsConstants.HOME_BASE_TAG);
            List <Vector2Int> ballPositionList = ActionCalculationUtils.CalculateBallFallPositionList(this.gameObject, 0, (int)MathUtils.HALF_CIRCLE_ANGLE_IN_DEGREE, 10, true, FieldUtils.GetGameObjectTilePositionOnField(homeBase));
            int        ballPositionIndex       = Random.Range(0, ballPositionList.Count - 1);
            Vector2Int ballTilePosition        = ballPositionList[ballPositionIndex];
            ballControllerScript.StopCoroutine(ballControllerScript.MovementCoroutine);
            ballControllerScript.Target = FieldUtils.GetTileCenterPositionInGameWorld(ballTilePosition);
            Vector2 direction                            = MathUtils.CalculateDirection(ballControllerScript.gameObject.transform.position, ballControllerScript.Target.Value);
            float   ballDirectionAngle                   = MathUtils.CalculateDirectionAngle(direction);
            Vector3 firstBasePosition                    = FieldUtils.GetTileCenterPositionInGameWorld(FieldUtils.GetFirstBaseTilePosition());
            Vector3 homeBasePosition                     = FieldUtils.GetTileCenterPositionInGameWorld(FieldUtils.GetHomeBaseTilePosition());
            float   homeBaseToFirstBaseDistance          = Vector3.Distance(homeBasePosition, firstBasePosition);
            Vector3 rigthSideFictionalPosition           = new Vector3(firstBasePosition.x, homeBasePosition.y, 0);
            float   homeBaseToRigthSideFictionalDistance = Vector3.Distance(homeBasePosition, rigthSideFictionalPosition);
            float   foulZoneAngle                        = Mathf.Acos(homeBaseToRigthSideFictionalDistance / homeBaseToFirstBaseDistance);

            //Fix calcul when the ball go to the left zone
            if (ballDirectionAngle < MathUtils.HALF_CIRCLE_ANGLE_IN_DEGREE - foulZoneAngle * Mathf.Rad2Deg && ballDirectionAngle > foulZoneAngle * Mathf.Rad2Deg)
            {
                RunnerBehaviour runnerBehaviour = this.ConvertBatterToRunner(playerStatusScript);
                this.AddRunnerAbilitiesToBatter(this.gameObject);
                playerStatusScript.IsAllowedToMove = true;
                runnerBehaviour.EnableMovement     = true;
            }

            playersTurnManager.IsRunnersTurnsDone = false;

            StartCoroutine(this.WaitToEnableBatCollider());
        }
        else
        {
            float            ballOutcomeRate        = ActionCalculationUtils.CalculateBallOutcomeProbability(ballControllerScript.CurrentPitcher);
            bool             isBallOutcome          = ActionCalculationUtils.HasActionSucceeded(ballOutcomeRate);
            DialogBoxManager dialogBoxManagerScript = GameUtils.FetchDialogBoxManager();
            string           outcomeMessage;

            if (!isBallOutcome)
            {
                StrikeOutcomeCount++;
                outcomeMessage = "STRIKE!!!";
            }
            else
            {
                BallOutcomeCount++;
                outcomeMessage = "BALL!!!";
            }

            ballControllerScript.IsPitched = true;
            ballControllerScript.Target    = FieldUtils.GetTileCenterPositionInGameWorld(FieldUtils.GetCatcherZonePosition());
            dialogBoxManagerScript.DisplayDialogAndTextForGivenAmountOfTime(1f, false, outcomeMessage);
        }
    }
Exemplo n.º 8
0
        private static IFeatureClass EnsureFeatureClass(IFeatureWorkspace ws,
                                                        esriGeometryType geometryType,
                                                        string name,
                                                        ISpatialReference sr)
        {
            try
            {
                IFeatureClass existing = DatasetUtils.OpenFeatureClass(ws, name);
                DatasetUtils.DeleteFeatureClass(existing);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            IFieldsEdit fields = new FieldsClass();

            fields.AddField(FieldUtils.CreateOIDField());

            fields.AddField(FieldUtils.CreateShapeField(
                                "Shape", geometryType,
                                sr, 1000, true));

            IFeatureClass fc = DatasetUtils.CreateSimpleFeatureClass(ws, name, fields);

            if (fc is IVersionedTable)
            {
                DatasetUtils.RegisterAsVersioned(fc);
            }

            return(fc);
        }
Exemplo n.º 9
0
        private void SetDefaultExchange(AfterFieldMappingEventArgs e)
        {
            ExtendedDataEntity[] entityArray = e.TargetExtendDataEntitySet.FindByEntityKey("FBillHead");
            e.TargetExtendDataEntitySet.FindByEntityKey("FSaleOrderEntry");
            ExtendedDataEntity[] entityArray2  = e.TargetExtendDataEntitySet.FindByEntityKey("FSaleOrderFinance");
            ICommonService       commonService = ServiceFactory.GetCommonService(base.Context);

            foreach (ExtendedDataEntity entity in entityArray2)
            {
                ExtendedDataEntity entity2 = entityArray[entity.DataEntityIndex];
                long       num             = Convert.ToInt64(entity2.DataEntity["SaleOrgId_Id"]);
                long       num2            = 0;
                long       num3            = 0;
                JSONObject defCurrencyAndExchangeTypeByBizOrgID = commonService.GetDefCurrencyAndExchangeTypeByBizOrgID(base.Context, num);
                if (defCurrencyAndExchangeTypeByBizOrgID != null)
                {
                    num2 = Convert.ToInt64(defCurrencyAndExchangeTypeByBizOrgID["FCyForID"]);
                    num3 = Convert.ToInt64(defCurrencyAndExchangeTypeByBizOrgID["FRateType"]);
                }
                BaseDataField field = e.TargetBusinessInfo.GetField("FExchangeTypeId") as BaseDataField;
                FieldUtils.SetBaseDataFieldValue(base.Context, field, entity.DataEntity, num3);
                long     num4 = Convert.ToInt64(entity.DataEntity["SettleCurrId_Id"]);
                DateTime time = Convert.ToDateTime(entityArray[entity.DataEntityIndex].DataEntity["Date"]);
                if ((num2 == num4) || (time == DateTime.MinValue))
                {
                    entity.DataEntity["ExchangeRate"] = 1;
                }
                else
                {
                    KeyValuePair <decimal, int> pair = commonService.GetExchangeRateAndDecimal(base.Context, num4, num2, num3, time, time);
                    entity.DataEntity["ExchangeRate"] = pair.Key;
                }
            }
        }
Exemplo n.º 10
0
        private static bool IsSameColor(EntityManager entityManager, Neighbours target, Neighbours neighbours, int2 position, Entity slot, Dictionary <int2, Entity> positions)
        {
            if ((target & neighbours) == 0)
            {
                return(false);
            }

            position += FieldUtils.NeighbourToInt2(target);
            Entity entity;

            if (positions.TryGetValue(position, out entity))
            {
                var currentColor = entityManager.GetComponentData <Chip>(entityManager.GetComponentData <ChipReference>(slot).Value).Color;
                if (!entityManager.HasComponent <ChipReference>(entity))
                {
                    return(false);
                }

                var newColor = entityManager.GetComponentData <Chip>(entityManager.GetComponentData <ChipReference>(entity).Value).Color;
                if (newColor == currentColor)
                {
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 11
0
        public void TestNonEqualXCoordinateDoubleField()
        {
            var featureClass = new FeatureClassMock(1, "Fc", esriGeometryType.esriGeometryPoint);

            featureClass.AddField(FieldUtils.CreateDoubleField(_fieldNameX));

            // create point feature
            const double x = 2600000;
            const double y = 1200000;
            const double z = 500;

            IFeature feature = CreateFeature(featureClass,
                                             x, x + 1.01 * _xyTolerance,
                                             y, null,
                                             z, null);

            var test = new QaValidCoordinateFields(featureClass,
                                                   _fieldNameX, null, null,
                                                   _xyTolerance, _zTolerance, _culture);

            var runner = new QaTestRunner(test);

            runner.Execute(feature);

            QaError error;

            AssertUtils.OneError(runner,
                                 "ValidCoordinateFields.XYFieldCoordinateValueTooFarFromShape",
                                 out error);
            Assert.AreEqual(_fieldNameX, error.AffectedComponent);
        }
Exemplo n.º 12
0
        public void TestEqualCoordinatesTextFields()
        {
            var featureClass = new FeatureClassMock(1, "Fc", esriGeometryType.esriGeometryPoint);

            featureClass.AddField(FieldUtils.CreateTextField(_fieldNameX, 50));
            featureClass.AddField(FieldUtils.CreateTextField(_fieldNameY, 50));
            featureClass.AddField(FieldUtils.CreateTextField(_fieldNameZ, 50));

            // create point feature
            const double x = 2600000.12345;
            const double y = 1200000.12345;
            const double z = 500.12345;

            IFeature feature = CreateFeature(
                featureClass,
                x, string.Format(_cultureInfo, "{0:N3}", x),
                y, string.Format(_cultureInfo, "{0:N3}", y),
                z, string.Format(_cultureInfo, "{0:N3}", z));

            var test = new QaValidCoordinateFields(featureClass,
                                                   _fieldNameX, _fieldNameY, _fieldNameZ,
                                                   _xyTolerance, _zTolerance, _culture);

            var runner = new QaTestRunner(test);

            runner.Execute(feature);

            Assert.AreEqual(0, runner.Errors.Count);
        }
Exemplo n.º 13
0
        public void TestNonEqualCoordinatesTextFieldsBothXYJustBelowTolerance()
        {
            var featureClass = new FeatureClassMock(1, "Fc", esriGeometryType.esriGeometryPoint);

            featureClass.AddField(FieldUtils.CreateTextField(_fieldNameX, 50));
            featureClass.AddField(FieldUtils.CreateTextField(_fieldNameY, 50));
            featureClass.AddField(FieldUtils.CreateTextField(_fieldNameZ, 50));

            // create point feature
            const double x = 2600000.12345;
            const double y = 1200000.12345;

            IFeature feature = CreateFeature(
                featureClass,
                x, string.Format(_cultureInfo, "{0:N3}", x + 0.9 * _xyTolerance),
                y, string.Format(_cultureInfo, "{0:N3}", y - 0.9 * _xyTolerance),
                z: 100, zFieldValue: "100");

            var test = new QaValidCoordinateFields(featureClass,
                                                   _fieldNameX, _fieldNameY, _fieldNameZ,
                                                   _xyTolerance, _zTolerance, _culture);

            var runner = new QaTestRunner(test);

            runner.Execute(feature);

            AssertUtils.OneError(runner,
                                 "ValidCoordinateFields.XYFieldCoordinatesTooFarFromShape");
        }
Exemplo n.º 14
0
        protected override void SetDefaultValues(List <ModuleFieldInfo> fields)
        {
            base.SetDefaultValues(fields);

            foreach (var field in fields)
            {
                if (field.DefaultValue != null && field.ControlType != CODES.DEFMODFLD.CTRLTYPE.CHECKEDCOMBOBOX)
                {
                    switch (field.FieldGroup)
                    {
                    case CODES.DEFMODFLD.FLDGROUP.COMMON:
                        this[field.FieldID] = FieldUtils.Convert(field, field.DefaultValue);
                        break;
                    }
                }
                else if (field.DefaultValue != null && field.ControlType == CODES.DEFMODFLD.CTRLTYPE.CHECKEDCOMBOBOX)
                {
                    using (var ctrlSA = new SAController())
                    {
                        List <string> values;
                        DataContainer con;
                        GetOracleParameterValues(out values, field.DefaultValue);
                        ctrlSA.ExecuteProcedureFillDataset(out con, field.DefaultValue, values);
                        var dsResult = con.DataSet;
                        this[field.FieldID] = FieldUtils.Convert(field, dsResult.Tables[0].Rows[0][0].ToString());
                    }
                }
            }
        }
Exemplo n.º 15
0
        private static void VerifyErrorHasZ(IFeatureWorkspace ws)
        {
            IFieldsEdit fields = new FieldsClass();

            fields.AddField(FieldUtils.CreateOIDField());
            fields.AddField(FieldUtils.CreateShapeField(
                                "Shape", esriGeometryType.esriGeometryPolyline,
                                SpatialReferenceUtils.CreateSpatialReference
                                    ((int)esriSRProjCS2Type.esriSRProjCS_CH1903Plus_LV95,
                                    true), 1000, true, false));

            IFeatureClass featureClass =
                DatasetUtils.CreateSimpleFeatureClass(ws, "VerifyErrorHasZ", fields,
                                                      null);

            // make sure the table is known by the workspace
            ((IWorkspaceEdit)ws).StartEditing(false);
            ((IWorkspaceEdit)ws).StopEditing(true);

            IPolycurve line1 = CurveConstruction.StartLine(0, 0, 5)
                               .LineTo(2, 0, 5)
                               .Curve;
            IFeature row1 = featureClass.CreateFeature();

            row1.Shape = line1;
            row1.Store();

            IPolycurve line2 = CurveConstruction.StartLine(-1, 0.02, 5)
                               .LineTo(1, 0.02, 5)
                               .Curve;
            IFeature row2 = featureClass.CreateFeature();

            row2.Shape = line2;
            row2.Store();

            var test = new QaNotNear(featureClass, 0.1, 0.5);

            var runners =
                new List <QaTestRunnerBase>
            {
                new QaTestRunner(test)
                {
                    KeepGeometry = true
                },
                new QaContainerTestRunner(1000, test)
                {
                    KeepGeometry = true
                }
            };

            foreach (QaTestRunnerBase runner in runners)
            {
                runner.Execute();
                Assert.True(runner.ErrorGeometries.Count > 0);
                foreach (IGeometry errorGeometry in runner.ErrorGeometries)
                {
                    Assert.AreEqual(5, errorGeometry.Envelope.ZMin);
                }
            }
        }
        public DocumentSearchResults <T> Search <T>(string userId, DocumentSearchRequest request)
        {
            JsonSerializer serializer = new JsonSerializer()
            {
                NullValueHandling = NullValueHandling.Ignore
            };

            var searchRequest = CreateRestRequest(URI_RESOURCE, Method.POST, ContentType.APPLICATION_JSON);

            JObject parameters = JObject.FromObject(request, serializer);
            var     fields     = new JObject();

            fields[RestApiConstants.INCLUDES]   = JToken.FromObject(FieldUtils.GetAllFields(typeof(T)));
            parameters[RestApiConstants.FIELDS] = fields;

            var body = new JObject();

            body[RestApiConstants.ACTION] = RestApiConstants.SEARCH;
            body[RestApiConstants.PARAMS] = parameters;

            string v = body.ToString();

            searchRequest.AddParameter(ContentType.APPLICATION_JSON, v, ParameterType.RequestBody);

            var result = Execute <DocumentSearchResults <T> >(GetOAuthInfo(userId), searchRequest);

            return(UnwrapResponse(result, new StatusCodeResponseHandler <DocumentSearchResults <T> >(HttpStatusCode.OK)));
        }
Exemplo n.º 17
0
        public void MultipartTest()
        {
            IFeatureWorkspace workspace =
                TestWorkspaceUtils.CreateInMemoryWorkspace("MultipartTest");

            IFieldsEdit fields = new FieldsClass();

            fields.AddField(FieldUtils.CreateOIDField());
            fields.AddField(FieldUtils.CreateShapeField(
                                "Shape", esriGeometryType.esriGeometryPolyline, CreateLV95(),
                                1000));

            IFeatureClass linesFc = DatasetUtils.CreateSimpleFeatureClass(workspace, "Flow",
                                                                          fields);

            AddFeature(
                linesFc,
                CurveConstruction.StartLine(0, 0).LineTo(4, 0).MoveTo(6, 0).LineTo(6, 10).Curve);
            AddFeature(linesFc, CurveConstruction.StartLine(4, 0).LineTo(6, 0).Curve);

            AddFeature(linesFc, CurveConstruction.StartLine(0, 20).LineTo(4, 20).Curve);

            AddFeature(
                linesFc,
                CurveConstruction.StartLine(0, 30).LineTo(4, 30).MoveTo(0, 32).LineTo(4, 30)
                .MoveTo(4, 30).LineTo(8, 30).Curve);

            // expect counter-clockwise: 0 errors
            var runner = new QaContainerTestRunner(
                1000, new QaFlowLogic(linesFc));

            Assert.AreEqual(3, runner.Execute());
        }
Exemplo n.º 18
0
        public GroupedField(bool negate, List <string> names, List <object> values) : base(negate)
        {
            if (values.Count != 1 && values.Count != names.Count)
            {
                throw new FieldException(
                          "Invalid usage of multi value search. Size of values should be one or equal to size of names.");
            }

            Names      = names;
            FieldTypes = new List <EntityFieldType>();
            foreach (var x in values)
            {
                if (x is ITermValue)
                {
                    ITermValue termValue = (ITermValue)x;
                    TermValues.Add(termValue);
                }
                else
                {
                    Values.Add(x);
                }
                FieldTypes.Add(FieldUtils.DetectFieldType(x));
            }

            if (TermValues.Count > 0 && Values.Count > 0)
            {
                throw new FieldException("Invalid usage of multi value search. All values should be either term values or not.");
            }
        }
Exemplo n.º 19
0
        public DataTable GetTable(List <ModuleFieldInfo> fields)
        {
            if (Container != null)
            {
                var dt = new DataTable();
                using (var sr = new StringReader(Container))
                {
                    dt.ReadXmlSchema(sr);
                    foreach (var field in fields)
                    {
                        if (dt.Columns.Contains(field.FieldName))
                        {
                            dt.Columns[field.FieldName].DataType = FieldUtils.GetType(field.FieldType);
                        }
                    }
                }

                using (var sr = new StringReader(Container))
                {
                    dt.ReadXml(sr);
                    foreach (DataRow row in dt.Rows)
                    {
                        row.AcceptChanges();
                    }
                    return(dt);
                }
            }

            return(null);
        }
Exemplo n.º 20
0
        public void FillTable(DataTable resultTable, List <ModuleFieldInfo> fields)
        {
            if (Container != null)
            {
                using (var sr = new StringReader(Container))
                {
                    resultTable.ReadXmlSchema(sr);
                    foreach (var field in fields)
                    {
                        if (resultTable.Columns.Contains(field.FieldName))
                        {
                            resultTable.Columns[field.FieldName].DataType = FieldUtils.GetType(field.FieldType);
                        }
                    }
                }

                using (var sr = new StringReader(Container))
                {
                    resultTable.ReadXml(sr);
                    foreach (DataRow row in resultTable.Rows)
                    {
                        row.AcceptChanges();
                    }
                }
            }
        }
Exemplo n.º 21
0
        private static IEnumerable <IField> CreateAttributeFields(
            [NotNull] IIssueStatisticsTableFieldNames fieldNames)
        {
            yield return(FieldUtils.CreateOIDField());

            yield return(FieldUtils.CreateTextField(fieldNames.IssueDescriptionField, 4000));

            yield return(FieldUtils.CreateTextField(fieldNames.IssueCodeField, 255));

            yield return(FieldUtils.CreateTextField(fieldNames.IssueCodeDescriptionField, 500));

            yield return(FieldUtils.CreateTextField(fieldNames.QualityConditionField, 255));

            yield return
                (FieldUtils.CreateTextField(fieldNames.QualityConditionDescriptionField, 4000));

            yield return(FieldUtils.CreateTextField(fieldNames.TestNameField, 255));

            yield return(FieldUtils.CreateTextField(fieldNames.TestDescriptionField, 4000));

            yield return(FieldUtils.CreateTextField(fieldNames.TestTypeField, 255));

            yield return(FieldUtils.CreateTextField(fieldNames.IssueTypeField, 20));

            yield return(FieldUtils.CreateTextField(fieldNames.StopConditionField, 20));

            yield return(FieldUtils.CreateTextField(fieldNames.CategoriesField, 1000));

            yield return(FieldUtils.CreateTextField(fieldNames.AffectedComponentField, 255));

            yield return(FieldUtils.CreateTextField(fieldNames.UrlField, 1000));

            yield return(FieldUtils.CreateIntegerField(fieldNames.IssueCountField));
        }
Exemplo n.º 22
0
        public void TestAllowedCoordinatesForUndefinedShape()
        {
            var featureClass = new FeatureClassMock(1, "Fc", esriGeometryType.esriGeometryPoint);

            featureClass.AddField(FieldUtils.CreateDoubleField(_fieldNameX));
            featureClass.AddField(FieldUtils.CreateDoubleField(_fieldNameY));
            featureClass.AddField(FieldUtils.CreateDoubleField(_fieldNameZ));

            // create point feature
            const double x = 2600000;
            const double y = 1200000;
            const double z = 500;

            IFeature feature = CreateFeature(featureClass,
                                             x, x,
                                             y, y,
                                             z, z);

            feature.Shape.SetEmpty();

            var test = new QaValidCoordinateFields(featureClass,
                                                   _fieldNameX, _fieldNameY, _fieldNameZ,
                                                   _xyTolerance, _zTolerance, _culture)
            {
                AllowXYFieldValuesForUndefinedShape = true,
                AllowZFieldValueForUndefinedShape   = true
            };

            var runner = new QaTestRunner(test);

            runner.Execute(feature);

            Assert.AreEqual(0, runner.Errors.Count);
        }
Exemplo n.º 23
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ObjectClassMock"/> class.
        /// </summary>
        /// <param name="objectClassId">The object class id.</param>
        /// <param name="name">The name.</param>
        /// <param name="aliasName">The alias name of the object class.</param>
        public ObjectClassMock(int objectClassId, string name, string aliasName)
        {
            ObjectClassID = objectClassId;
            _name         = name;
            AliasName     = aliasName;

            _fieldsMock.AddFields(FieldUtils.CreateOIDField(_oidFieldName));
        }
Exemplo n.º 24
0
 private string GetUnexpectedFieldTypeMessage([NotNull] IField field)
 {
     return(string.Format(
                "Expected field type for field '{0}': {1}. Actual field type: {2}",
                FieldName,
                FieldUtils.GetFieldTypeDisplayText(_expectedFieldType),
                FieldUtils.GetFieldTypeDisplayText(field.Type)));
 }
Exemplo n.º 25
0
 public void PitchBallAction(GameObject actionUser)
 {
     //PITCHER TURN
     //literaly throw the ball!!!
     ballGameObject.SetActive(true);
     BallControllerScript.BallHeight = BallHeightEnum.LOW;
     BallControllerScript.IsPitched  = true;
     BallControllerScript.Target     = FieldUtils.GetTileCenterPositionInGameWorld(FieldUtils.GetHomeBaseTilePosition());
 }
Exemplo n.º 26
0
        internal static void FromJson(object @object, JObject targetAttributes)
        {
            FieldInfo[] mClassFields = FieldUtils.GetAllFields(@object.GetType()); //get fields in this class

            foreach (FieldInfo f in mClassFields)
            {
                ParseFieldValue(@object, targetAttributes, f);
            }
        }
Exemplo n.º 27
0
    private void InitiateRunnerAction(PlayerStatus playerStatus)
    {
        Nullable <Vector3> targetPosition;

        targetPosition   = FieldUtils.GetTileCenterPositionInGameWorld(FieldUtils.GetFirstBaseTilePosition());
        this.CurrentBase = BaseEnum.NONE;
        this.NextBase    = BaseEnum.HOME_BASE;
        Target           = targetPosition;
    }
Exemplo n.º 28
0
        private static void CanDetect1ToNUnique([NotNull] IFeatureWorkspace workspace)
        {
            const string uniqueFieldName = "Unique";

            ITable tableOrig;
            {
                IFieldsEdit fields = new FieldsClass();
                fields.AddField(FieldUtils.CreateOIDField());
                fields.AddField(FieldUtils.CreateField(
                                    uniqueFieldName, esriFieldType.esriFieldTypeInteger));
                ITable table = TestWorkspaceUtils.CreateSimpleTable(
                    workspace, "Relate1NUnique1", fields);
                for (var i = 0; i < 10; i++)
                {
                    IRow row = table.CreateRow();
                    row.set_Value(1, i);
                    row.Store();
                }

                tableOrig = table;
            }
            ITable tableRel;
            {
                IFieldsEdit fields = new FieldsClass();
                fields.AddField(FieldUtils.CreateOIDField());
                fields.AddField(FieldUtils.CreateField(
                                    "Ref", esriFieldType.esriFieldTypeInteger));
                ITable table = TestWorkspaceUtils.CreateSimpleTable(
                    workspace, "Relate1NUnique2", fields);
                for (var i = 0; i < 10; i++)
                {
                    IRow row = table.CreateRow();
                    row.set_Value(1, i);
                    row.Store();
                }

                tableRel = table;
            }
            IRelationshipClass rel =
                TestWorkspaceUtils.CreateSimple1NRelationship(workspace,
                                                              "rel1NUnique", tableOrig,
                                                              tableRel, uniqueFieldName, "Ref");

            ITable relTab = TableJoinUtils.CreateQueryTable(rel, JoinType.InnerJoin);

            foreach (bool forceInMemoryTableSort in new[] { true, false })
            {
                var test = new QaUnique(relTab, "Relate1NUnique1." + uniqueFieldName)
                {
                    ForceInMemoryTableSorting = forceInMemoryTableSort
                };

                var runner = new QaTestRunner(test);
                runner.Execute();
                AssertUtils.NoError(runner);
            }
        }
Exemplo n.º 29
0
        private void TestConnections(IFeatureWorkspace ws)
        {
            IFieldsEdit fields = new FieldsClass();

            fields.AddField(FieldUtils.CreateOIDField());
            fields.AddField(FieldUtils.CreateIntegerField("LineTyp", "LineTyp"));
            fields.AddField(FieldUtils.CreateShapeField(
                                "Shape", esriGeometryType.esriGeometryPolyline,
                                SpatialReferenceUtils.CreateSpatialReference
                                    ((int)esriSRProjCS2Type.esriSRProjCS_CH1903Plus_LV95,
                                    true), 1000, false, false));

            IFeatureClass fc =
                DatasetUtils.CreateSimpleFeatureClass(ws, "TestConnections", fields,
                                                      null);
            IList <ITable> tbls = new[] { (ITable)fc };

            // make sure the table is known by the workspace
            ((IWorkspaceEdit)ws).StartEditing(false);
            ((IWorkspaceEdit)ws).StopEditing(true);

            {
                IFeature row = fc.CreateFeature();
                row.set_Value(1, 1);
                row.Shape =
                    CurveConstruction.StartLine(100, 100).LineTo(200, 200).Curve;
                row.Store();
            }
            {
                IFeature row = fc.CreateFeature();
                row.set_Value(1, 2);
                row.Shape =
                    CurveConstruction.StartLine(100, 100.1).LineTo(100, 200).Curve;
                row.Store();
            }

            IList <QaConnectionRule> rules = new[]
            {
                new QaConnectionRule(tbls, new[] { "LineTyp = 1" }),
                new QaConnectionRule(tbls, new[] { "LineTyp = 2" })
            };
            var test = new QaConnections(new[] { fc }, rules, 0);

            test.QaError += Test_QaError;
            _errorCount   = 0;
            test.Execute();
            Assert.AreEqual(0, _errorCount);
            test.QaError -= Test_QaError;

            var container = new TestContainer();

            container.AddTest(test);
            container.QaError += Test_QaError;
            _errorCount        = 0;
            container.Execute();
            Assert.AreEqual(0, _errorCount);
        }
Exemplo n.º 30
0
 private static ITable CreateTable(
     [NotNull] string name,
     [NotNull] IFeatureWorkspace workspace,
     [NotNull] IIssueStatisticsTableFieldNames fieldNames)
 {
     return(DatasetUtils.CreateTable(workspace, name, null,
                                     FieldUtils.CreateFields(
                                         CreateAttributeFields(fieldNames))));
 }