Ejemplo n.º 1
0
        public void TestBlockGeneration()
        {
            var block         = new PathBlock(64, 1, 10, 0);
            var retVal        = 0.5;
            var gen           = new Constant(retVal);
            var fetCollection = new FeatureCollection();
            var engine        = new FakeEngine();

            fetCollection.AddFeature <IEngineFeature>(engine);
            fetCollection.AddFeature <ITimeStepsFeature>(engine);
            fetCollection.AddFeature <IPathMappingFeature>(engine);

            gen.Process(block);

            for (var i = 0; i < 64 * 10; i++)
            {
                Assert.Equal(retVal, block[i]);
            }

            gen.UseNormalInverse = true;
            gen.Process(block);
            retVal = Statistics.NormInv(retVal);
            for (var i = 0; i < 64 * 10; i++)
            {
                Assert.Equal(retVal, block[i]);
            }
        }
        public void AddFeatureAlreadyInCollectionThrowsException()
        {
            Assert.Throws <ArgumentException>(() =>
            {
                var collection = new FeatureCollection();

                collection.AddFeature <FeatureCollectionFullNodeFeature>();
                collection.AddFeature <FeatureCollectionFullNodeFeature>();
            });
        }
        public void AddToCollectionReturnsOfGivenType()
        {
            var collection = new FeatureCollection();

            collection.AddFeature <FeatureCollectionFullNodeFeature>();

            Assert.Single(collection.FeatureRegistrations);
            Assert.Equal(typeof(FeatureCollectionFullNodeFeature), collection.FeatureRegistrations[0].FeatureType);
        }
Ejemplo n.º 4
0
        private void LoadSubFeatures()
        {
            ActionableObjectList aol = new ActionableObjectList();
            List <Type>          ActionableObjectNames = new List <Type>();

            ActionableObjectNames = aol.AllClasses.Where(x => x.Name.StartsWith("AOM")).ToList();

            SubFeatures = new FeatureCollection();
            int indx = 0;

            foreach (Type ty in ActionableObjectNames)
            {
                string ShTxt = ty.GetProperty("ShortText").GetValue(aol.AllActionableObjectList[indx]).ToString();
                SubFeatures.AddFeature(String.Join(" ", SplitCamelCase(ty.Name.Replace("AOM", ""))), "../img/MenuImages/actionableobjects.png", ShTxt, false, "Menu");
                indx++;
            }
        }
Ejemplo n.º 5
0
 private void LoadSubFeatures()
 {
     SubFeatures = new FeatureCollection();
     if (File.Exists("WorkflowMenu.xml"))
     {
         XElement root = XElement.Load("WorkflowMenu.xml");
         root.Elements("Menu").All <XElement>(xe =>
         {
             SubFeatures.AddFeature(xe.Attribute("Name").Value.ToUpper(),
                                    xe.Attribute("Icon").Value,
                                    xe.Attribute("ShortText").Value,
                                    Convert.ToBoolean(xe.Attribute("HasChild").Value),
                                    xe.Attribute("MenuType").Value);
             return(true);
         });
     }
 }