public LoadFacadeOfModelInstanceManager(ILfmimLocalContextProvider lfmimlocalcontextprovider)
 {
     lfmimLocalContextProvider = lfmimlocalcontextprovider;
     propertyFactory           = lfmimLocalContextProvider.GetPropertyFactory;
     modelManager = lfmimLocalContextProvider.GetModelManager;
     IsFinalized  = false;
 }
        public static PropertyInitializationResult Initialize(
            Type testClassType,
            MethodInfo testMethodInfo,
            object[] constructorArguments,
            IPropertyFactory propertyFactory)
        {
            var testClassInstance = Activator.CreateInstance(testClassType, constructorArguments);
            var propertyAttribute = testMethodInfo.GetCustomAttributes <PropertyAttribute>(inherit: true).Single();

            var genFactory = TryResolveGenFactory(testClassType, testMethodInfo);
            var customGens = ResolveCustomGens(testClassInstance, testMethodInfo);
            var property   = propertyFactory.CreateProperty(testMethodInfo, testClassInstance, genFactory, customGens);
            var replay     = testMethodInfo.GetCustomAttributes <ReplayAttribute>().SingleOrDefault()?.Replay;

            var propertyRunParameters = new PropertyRunParameters(
                Property: property,
                Iterations: propertyAttribute.Iterations,
                ShrinkLimit: propertyAttribute.ShrinkLimit,
                Replay: replay,
                Seed: replay == null ? propertyAttribute.NullableSeed : null,
                Size: replay == null ? propertyAttribute.NullableSize : null);

            return(new PropertyInitializationResult(
                       propertyAttribute.Runner,
                       propertyRunParameters,
                       propertyAttribute.Skip?.Length > 0 ? propertyAttribute.Skip : null));
        }
Example #3
0
        private void DrawChampionStatistic(Champion champion, Vector2 position)
        {
            var batcher      = GameConsole.Instance?.Batcher;
            var whiteTexture = GameConsole.Instance?.WhiteTexture;
            var font         = ResourceProvider.Instance.DefaultFont;

            var properties = new IPropertyFactory[]
            {
                PropertyFactory <HealthProperty> .Instance,
                PropertyFactory <StaminaProperty> .Instance,
                PropertyFactory <ManaProperty> .Instance,
            };

            var str = champion.Name + Environment.NewLine + string.Join(Environment.NewLine, properties.Select(pf =>
            {
                var p = champion.GetProperty(pf);
                return($"{p.GetType().Name}: {p.Value}/{p.MaxValue}");
            }));

            batcher.Begin(SpriteSortMode.Deferred, null, SamplerState.PointClamp, null, null, null, null);
            var rec = new Rectangle(position.ToPoint(), new Point(200, 80));
            var c   = new Color(Color.Black, 0.5f);

            batcher.Draw(whiteTexture, rec, c);
            batcher.DrawString(font, str, position, Color.White);

            batcher.End();
        }
Example #4
0
        public IProperty GetProperty(IPropertyFactory propertyType)
        {
            IProperty res;

            properties.TryGetValue(propertyType, out res);
            return(res ?? new EmptyProperty());
        }
        public async Task WhenThePropertyIsConfigurationIndependent_ThenOnlyOneValueIsReturned()
        {
            var parent = IEntityWithIdFactory.Create(key: "ParentName", value: "Aardvark");

            var defaultConfiguration = ProjectConfigurationFactory.Create("Alpha|Beta");
            var otherConfiguration   = ProjectConfigurationFactory.Create("Delta|Gamma");
            var cache = IPropertyPageQueryCacheFactory.Create(
                projectConfigurations: ImmutableHashSet <ProjectConfiguration> .Empty.Add(defaultConfiguration).Add(otherConfiguration),
                defaultConfiguration: defaultConfiguration,
                bindToRule: (config, schemaName) => IRuleFactory.Create(
                    name: "ParentName",
                    properties: new[] { IPropertyFactory.Create("MyProperty") }));

            var schema = new Rule
            {
                Properties =
                {
                    new TestProperty {
                        Name = "MyProperty", DataSource = new(){ HasConfigurationCondition                            = false }
                    }
                }
            };
            var propertyName        = "MyProperty";
            var requestedProperties = PropertiesAvailableStatusFactory.CreateUIPropertyValuePropertiesAvailableStatus();
            var results             = await UIPropertyValueDataProducer.CreateUIPropertyValueValuesAsync(
                parent,
                cache,
                schema,
                propertyName,
                requestedProperties);

            Assert.Single(results);
        }
Example #6
0
 public override IProperty GetProperty(IPropertyFactory propertyType)
 {
     IProperty val;
     if (properties.TryGetValue(propertyType, out val))
         return val;
     else
         return new EmptyProperty();
 }
        public PageComparingFactory(IEqualityComparer<HtmlNode> comparer)
        {
            if (comparer == null)
            {
                throw new ArgumentNullException("comparer");
            }

            this.comparer = comparer;
            this.propertyFactory = new PropertyFactory();
            this.skeletonExtractor = new SkeletonExtractor(comparer);
            this.builder = new Builder(comparer, propertyFactory);
        }
Example #8
0
        public Properties(
            TType declaringType,
            IPropertyFactory <TProperty, TIndexer, TType> propertyFactory,
            IDictionary <MethodInfo, Type> interfaceMethods)
        {
            List <TIndexer>  indexers   = new List <TIndexer>();
            List <TProperty> properties = new List <TProperty>();
            List <AbstractIndexerWithReflection>           abstractIndexers            = new List <AbstractIndexerWithReflection>();
            List <AbstractPropertyWithReflection>          abstractProperties          = new List <AbstractPropertyWithReflection>();
            List <ExplicitInterfaceIndexerWithReflection>  explicitInterfaceIndexers   = new List <ExplicitInterfaceIndexerWithReflection>();
            List <ExplicitInterfacePropertyWithReflection> explicitInterfaceProperties = new List <ExplicitInterfacePropertyWithReflection>();

            foreach (PropertyInfo property in declaringType.Type.GetAllProperties())
            {
                MethodInfo method = property.Method();
                Type       interfaceType;
                if (property.GetIndexParameters().Any())
                {
                    if (interfaceMethods.TryGetValue(method, out interfaceType))
                    {
                        explicitInterfaceIndexers.Add(new ExplicitInterfaceIndexerWithReflection(declaringType, interfaceType, property));
                    }
                    else if (method.IsAbstract)
                    {
                        abstractIndexers.Add(new AbstractIndexerWithReflection(declaringType, property));
                    }
                    else
                    {
                        indexers.Add(propertyFactory.CreateIndexer(declaringType, property));
                    }
                }
                else if (interfaceMethods.TryGetValue(method, out interfaceType))
                {
                    explicitInterfaceProperties.Add(new ExplicitInterfacePropertyWithReflection(declaringType, interfaceType, property));
                }
                else if (method.IsAbstract)
                {
                    abstractProperties.Add(new AbstractPropertyWithReflection(declaringType, property));
                }
                else
                {
                    properties.Add(propertyFactory.CreateProperty(declaringType, property));
                }
            }

            ExplicitInterfaceIndexersWithReflection   = explicitInterfaceIndexers;
            ExplicitInterfacePropertiesWithReflection = explicitInterfaceProperties;
            AbstractIndexersWithReflection            = abstractIndexers;
            AbstractPropertiesWithReflection          = abstractProperties;
            IndexersWithReflection   = indexers;
            PropertiesWithReflection = properties;
        }
        public void WhenThePropertyIsConfigurationIndependent_ThenNoDimensionsAreProduced()
        {
            var properties = PropertiesAvailableStatusFactory.CreateConfigurationDimensionAvailableStatus(includeAllProperties: true);

            var parentEntity  = IEntityWithIdFactory.Create("ParentKey", "ParentKeyValue");
            var configuration = ProjectConfigurationFactory.Create("Alpha|Beta|Gamma", "A|B|C");
            var property      = IPropertyFactory.Create(
                dataSource: IDataSourceFactory.Create(hasConfigurationCondition: false));

            var results = ConfigurationDimensionDataProducer.CreateProjectConfigurationDimensions(parentEntity, configuration, property, properties);

            Assert.Empty(results);
        }
Example #10
0
        public override IProperty GetProperty(IPropertyFactory propertyType)
        {
            IProperty val;

            if (properties.TryGetValue(propertyType, out val))
            {
                return(val);
            }
            else
            {
                return(new EmptyProperty());
            }
        }
Example #11
0
        public MenuAnalyzer(IPropertyFactory propertyFactory, params string[] xpathMenuLocations)
        {
            if (propertyFactory == null)
            {
                throw new ArgumentNullException("prepertyFactory");
            }
            if (xpathMenuLocations == null)
            {
                throw new ArgumentNullException("xpathMenuLocations");
            }

            this.propertyFactory = propertyFactory;
            this.xpathMenuLocations = xpathMenuLocations;
        }
Example #12
0
        public Properties(
            TType declaringType,
            IPropertyFactory <TProperty, TIndexer, TType> propertyFactory)
        {
            List <TIndexer>  indexers   = new List <TIndexer>();
            List <TProperty> properties = new List <TProperty>();
            List <AbstractIndexerWithMonoCecil>           abstractIndexers            = new List <AbstractIndexerWithMonoCecil>();
            List <AbstractPropertyWithMonoCecil>          abstractProperties          = new List <AbstractPropertyWithMonoCecil>();
            List <ExplicitInterfaceIndexerWithMonoCecil>  explicitInterfaceIndexers   = new List <ExplicitInterfaceIndexerWithMonoCecil>();
            List <ExplicitInterfacePropertyWithMonoCecil> explicitInterfaceProperties = new List <ExplicitInterfacePropertyWithMonoCecil>();

            foreach (PropertyDefinition property in declaringType.TypeDefinition.Properties)
            {
                MethodDefinition method = property.Method();
                if (property.Parameters.Any())
                {
                    if (property.Name.Contains("."))
                    {
                        explicitInterfaceIndexers.Add(new ExplicitInterfaceIndexerWithMonoCecil(declaringType, property));
                    }
                    else if (method.IsAbstract)
                    {
                        abstractIndexers.Add(new AbstractIndexerWithMonoCecil(declaringType, property));
                    }
                    else
                    {
                        indexers.Add(propertyFactory.CreateIndexer(declaringType, property));
                    }
                }
                else if (property.Name.Contains("."))
                {
                    explicitInterfaceProperties.Add(new ExplicitInterfacePropertyWithMonoCecil(declaringType, property));
                }
                else if (method.IsAbstract)
                {
                    abstractProperties.Add(new AbstractPropertyWithMonoCecil(declaringType, property));
                }
                else
                {
                    properties.Add(propertyFactory.CreateProperty(declaringType, property));
                }
            }

            ExplicitInterfaceIndexersWithMonoCecil   = explicitInterfaceIndexers;
            ExplicitInterfacePropertiesWithMonoCecil = explicitInterfaceProperties;
            AbstractIndexersWithMonoCecil            = abstractIndexers;
            AbstractPropertiesWithMonoCecil          = abstractProperties;
            IndexersWithMonoCecil   = indexers;
            PropertiesWithMonoCecil = properties;
        }
Example #13
0
        /// <summary>
        /// Builder
        /// </summary>
        /// <param name="comparer">comparer</param>
        /// <param name="propertyFactory">property Factory</param>
        /// <returns></returns>
        public Builder(IEqualityComparer<HtmlNode> comparer, IPropertyFactory propertyFactory)
        {
            if (comparer == null)
            {
                throw new ArgumentNullException("comparer");
            }
            if (propertyFactory == null)
            {
                throw new ArgumentNullException("propertyFactory");
            }

            this.comparer = comparer;
            this.propertyFactory = propertyFactory;
        }
        public void WhenThePropertyIsConfigurationDependent_OneEntityIsCreatedPerDimension()
        {
            var properties = PropertiesAvailableStatusFactory.CreateConfigurationDimensionAvailableStatus(includeAllProperties: true);

            var parentEntity  = IEntityWithIdFactory.Create("ParentKey", "ParentKeyValue");
            var configuration = ProjectConfigurationFactory.Create("Alpha|Beta|Gamma", "A|B|C");
            var property      = IPropertyFactory.Create(
                dataSource: IDataSourceFactory.Create(hasConfigurationCondition: true));

            var results = ConfigurationDimensionDataProducer.CreateProjectConfigurationDimensions(parentEntity, configuration, property, properties);

            // We can't guarantee an order for the dimensions, so just check that all the expected values are present.
            Assert.Contains(results, entity => entity is ConfigurationDimensionValue {
                Name: "Alpha", Value: "A"
            });
        /// <summary>
        /// Initializes a new instance of the <see cref="CachedPropertyFactory"/> class.
        /// </summary>
        /// <param name="propertyFactory">Property factory that creates properties.</param>
        /// <param name="maxItemCount">If maxItemCount is set that <see cref="TwoLayerCache{TKey,TValue}"/> uses for caching.</param>
        public CachedPropertyFactory(
            IPropertyFactory?propertyFactory = null,
            int?maxItemCount = null)
        {
            _propertyFactory = propertyFactory ?? new PropertyFactory();

            if (maxItemCount == null)
            {
                // unlimited cache
                _propertyValuesCache = new Core.ConcurrentDictionaryAdapter <CacheKey, IProperty>(new ConcurrentDictionary <CacheKey, IProperty>());
            }
            else
            {
                // limited cache
                _propertyValuesCache = new Core.TwoLayerCache <CacheKey, IProperty>(maxItemCount.Value);
            }
        }
Example #16
0
        public async Task WhenCreatingValuesFromAnIProperty_WeGetOneValuePerIEnumValue()
        {
            var properties = PropertiesAvailableStatusFactory.CreateSupportedValuesPropertiesAvailableStatus();

            var entityRuntime = IEntityRuntimeModelFactory.Create();
            var iproperty     = IPropertyFactory.CreateEnum(new[]
            {
                IEnumValueFactory.Create(displayName: "Alpha", name: "a"),
                IEnumValueFactory.Create(displayName: "Beta", name: "b"),
                IEnumValueFactory.Create(displayName: "Gamma", name: "c")
            });

            var result = await SupportedValueDataProducer.CreateSupportedValuesAsync(entityRuntime, iproperty, properties);

            Assert.Collection(result, new Action <IEntityValue>[]
            {
                entity => assertEqual(entity, expectedDisplayName: "Alpha", expectedValue: "a"),
                entity => assertEqual(entity, expectedDisplayName: "Beta", expectedValue: "b"),
                entity => assertEqual(entity, expectedDisplayName: "Gamma", expectedValue: "c")
            });
Example #17
0
        public InvocationExpressionPropertyTypeConvertor(
            IPropertyFactory propertyFactory,
            ILocationFactory locationFactory,
            IUnderlyingObjectFactory underlyingObjectFactory)
        {
            if (propertyFactory == null)
            {
                throw new ArgumentNullException(nameof(propertyFactory));
            }
            if (locationFactory == null)
            {
                throw new ArgumentNullException(nameof(locationFactory));
            }
            if (underlyingObjectFactory == null)
            {
                throw new ArgumentNullException(nameof(underlyingObjectFactory));
            }

            this.propertyFactory         = propertyFactory;
            this.locationFactory         = locationFactory;
            this.underlyingObjectFactory = underlyingObjectFactory;
        }
Example #18
0
 // Creates a ConfiguredProject with a given ProjectConfiguration, and a method to
 // call when a property is set in that configuration.
 private static ConfiguredProject CreateConfiguredProject(ProjectConfiguration configuration, Action <string, object?> setValueCallback)
 {
     return(ConfiguredProjectFactory.Create(
                projectConfiguration: configuration,
                services: ConfiguredProjectServicesFactory.Create(
                    IPropertyPagesCatalogProviderFactory.Create(new()
     {
         {
             "Project",
             IPropertyPagesCatalogFactory.Create(new Dictionary <string, ProjectSystem.Properties.IRule>()
             {
                 { "MyPage", IRuleFactory.CreateFromRule(new Rule
                     {
                         Name = "MyPage",
                         Properties = new()
                         {
                             new TestProperty
                             {
                                 Name = "MyProperty",
                                 DataSource = new() { HasConfigurationCondition = true }
                             },
                             new TestProperty
                             {
                                 Name = "MyOtherProperty",
                                 DataSource = new() { HasConfigurationCondition = true }
                             }
                         }
                     },
                                                         properties: new[]
                     {
                         IPropertyFactory.Create(
                             "MyProperty",
                             dataSource: IDataSourceFactory.Create(hasConfigurationCondition: true),
                             setValue: v => setValueCallback("MyProperty", v)),
                         IPropertyFactory.Create(
                             "MyOtherProperty",
                             dataSource: IDataSourceFactory.Create(hasConfigurationCondition: true),
                             setValue: v => setValueCallback("MyOtherProperty", v))
                     }) }
Example #19
0
        public async Task WhenDimensionsAreGiven_ThenThePropertyIsOnlySetInTheMatchingConfigurations()
        {
            var project = UnconfiguredProjectFactory.Create(fullPath: @"C:\alpha\beta\MyProject.csproj");

            var projectConfigurations = GetConfigurations();

            var affectedConfigs = new List <string>();

            var queryCacheProvider = IPropertyPageQueryCacheProviderFactory.Create(
                IPropertyPageQueryCacheFactory.Create(
                    projectConfigurations,
                    bindToRule: (config, schemaName) => IRuleFactory.Create(
                        name: "MyPage",
                        properties: new[]
            {
                IPropertyFactory.Create("MyProperty", setValue: o => affectedConfigs.Add(config.Name))
            })));
            var targetDimensions = new List <(string dimension, string value)>
            {
                ("Configuration", "Release"),
                ("Platform", "x86")
            };

            var coreActionExecutor = new ProjectSetUIPropertyValueActionCore(
                queryCacheProvider,
                pageName: "MyPage",
                propertyName: "MyProperty",
                targetDimensions,
                prop => prop.SetValueAsync("new value"));

            await coreActionExecutor.OnBeforeExecutingBatchAsync(new[] { project });

            await coreActionExecutor.ExecuteAsync(project);

            coreActionExecutor.OnAfterExecutingBatch();

            Assert.Single(affectedConfigs);
            Assert.Contains("Release|x86", affectedConfigs);
        }
Example #20
0
        public async Task WhenNoDimensionsAreGiven_ThenThePropertyIsSetInAllConfigurations()
        {
            var project = UnconfiguredProjectFactory.Create(fullPath: @"C:\alpha\beta\MyProject.csproj");

            var projectConfigurations = GetConfigurations();

            var affectedConfigs = new List <string>();

            var queryCacheProvider = IPropertyPageQueryCacheProviderFactory.Create(
                IPropertyPageQueryCacheFactory.Create(
                    projectConfigurations,
                    bindToRule: (config, schemaName) => IRuleFactory.Create(
                        name: "MyPage",
                        properties: new[]
            {
                IPropertyFactory.Create("MyProperty", setValue: o => affectedConfigs.Add(config.Name))
            })));
            var emptyTargetDimensions = Enumerable.Empty <(string dimension, string value)>();

            var coreActionExecutor = new ProjectSetUIPropertyValueActionCore(
                queryCacheProvider,
                pageName: "MyPage",
                propertyName: "MyProperty",
                emptyTargetDimensions,
                prop => prop.SetValueAsync("new value"));

            await coreActionExecutor.OnBeforeExecutingBatchAsync(new[] { project });

            await coreActionExecutor.ExecuteAsync(project);

            coreActionExecutor.OnAfterExecutingBatch();

            Assert.Equal(expected: 4, actual: affectedConfigs.Count);
            foreach (var configuration in projectConfigurations)
            {
                Assert.Contains(configuration.Name, affectedConfigs);
            }
        }
Example #21
0
        public async Task WhenARuleContainsMultipleProperties_ThenOnlyTheSpecifiedPropertyIsSet()
        {
            var project = UnconfiguredProjectFactory.Create(fullPath: @"C:\alpha\beta\MyProject.csproj");
            var projectConfigurations = GetConfigurations();

            var unrelatedPropertySet = false;

            var queryCacheProvider = IPropertyPageQueryCacheProviderFactory.Create(
                IPropertyPageQueryCacheFactory.Create(
                    projectConfigurations,
                    bindToRule: (config, schemaName) => IRuleFactory.Create(
                        name: "MyPage",
                        properties: new[]
            {
                IPropertyFactory.Create("MyProperty", setValue: o => { }),
                IPropertyFactory.Create("NotTheCorrectProperty", setValue: o => unrelatedPropertySet = true)
            })));
            var targetDimensions = new List <(string dimension, string value)>
            {
                ("Configuration", "Release"),
                ("Platform", "x86")
            };

            var coreActionExecutor = new ProjectSetUIPropertyValueActionCore(
                queryCacheProvider,
                pageName: "MyPage",
                propertyName: "MyProperty",
                targetDimensions,
                prop => prop.SetValueAsync("new value"));

            await coreActionExecutor.OnBeforeExecutingBatchAsync(new[] { project });

            await coreActionExecutor.ExecuteAsync(project);

            coreActionExecutor.OnAfterExecutingBatch();

            Assert.False(unrelatedPropertySet);
        }
Example #22
0
        public async Task WhenDimensionsAreGiven_ThenThePropertyIsOnlySetInTheMatchingConfigurations()
        {
            var project = UnconfiguredProjectFactory.Create(
                fullPath: @"C:\alpha\beta\MyProject.csproj",
                configuredProject: ConfiguredProjectFactory.Create(
                    services: ConfiguredProjectServicesFactory.Create(
                        IPropertyPagesCatalogProviderFactory.Create(new()
            {
                {
                    "Project",
                    IPropertyPagesCatalogFactory.Create(new Dictionary <string, ProjectSystem.Properties.IRule>()
                    {
                        { "MyPage", IRuleFactory.Create(new Rule
                            {
                                Name       = "MyPage",
                                Properties = new()
                                {
                                    new TestProperty
                                    {
                                        Name       = "MyProperty",
                                        DataSource = new() { HasConfigurationCondition = true }
                                    }
                                }
                            }) }
                    })
                }
            }))));
            var projectConfigurations = GetConfigurations();

            var affectedConfigs = new List <string>();

            var queryCacheProvider = IProjectStateProviderFactory.Create(
                IProjectStateFactory.Create(
                    projectConfigurations,
                    bindToRule: (config, schemaName, context) => IRuleFactory.Create(
                        name: "MyPage",
                        properties: new[]
            {
                IPropertyFactory.Create(
                    "MyProperty",
                    dataSource: IDataSourceFactory.Create(hasConfigurationCondition: true),
                    setValue: o => affectedConfigs.Add(config.Name))
            })));
            var targetDimensions = new List <(string dimension, string value)>
            {
                ("Configuration", "Release"),
                ("Platform", "x86")
            };

            var coreActionExecutor = new ProjectSetUIPropertyValueActionCore(
                queryCacheProvider,
                pageName: "MyPage",
                propertyName: "MyProperty",
                targetDimensions,
                prop => prop.SetValueAsync("new value"));

            await coreActionExecutor.OnBeforeExecutingBatchAsync(new[] { project });

            bool propertyUpdated = await coreActionExecutor.ExecuteAsync(project);

            coreActionExecutor.OnAfterExecutingBatch();

            Assert.True(propertyUpdated);
            Assert.Single(affectedConfigs);
            Assert.Contains("Release|x86", affectedConfigs);
        }
Example #23
0
 public override IProperty GetProperty(IPropertyFactory propertyType) => properties.FirstOrDefault(p => p.Type == propertyType) ?? new EmptyProperty();
Example #24
0
 public Properties(IPropertyFactory propertyFactory)
 {
     this.propertyFactory = propertyFactory;
 }
Example #25
0
        public async Task WhenNoDimensionsAreGiven_ThenThePropertyIsSetInAllConfigurations()
        {
            var project = UnconfiguredProjectFactory.Create(
                fullPath: @"C:\alpha\beta\MyProject.csproj",
                configuredProject: ConfiguredProjectFactory.Create(
                    services: ConfiguredProjectServicesFactory.Create(
                        IPropertyPagesCatalogProviderFactory.Create(new()
            {
                {
                    "Project",
                    IPropertyPagesCatalogFactory.Create(new Dictionary <string, ProjectSystem.Properties.IRule>()
                    {
                        { "MyPage", IRuleFactory.Create(new Rule
                            {
                                Name       = "MyPage",
                                Properties = new()
                                {
                                    new TestProperty
                                    {
                                        Name       = "MyProperty",
                                        DataSource = new() { HasConfigurationCondition = true }
                                    }
                                }
                            }) }
                    })
                }
            }))));

            var projectConfigurations = GetConfigurations();

            var affectedConfigs = new List <string>();

            var queryCacheProvider = IProjectStateProviderFactory.Create(
                IProjectStateFactory.Create(
                    projectConfigurations,
                    bindToRule: (config, schemaName, context) => IRuleFactory.Create(
                        name: "MyPage",
                        properties: new[]
            {
                IPropertyFactory.Create(
                    "MyProperty",
                    dataSource: IDataSourceFactory.Create(hasConfigurationCondition: true),
                    setValue: o => affectedConfigs.Add(config.Name))
            })));
            var emptyTargetDimensions = Enumerable.Empty <(string dimension, string value)>();

            var coreActionExecutor = new ProjectSetUIPropertyValueActionCore(
                queryCacheProvider,
                pageName: "MyPage",
                propertyName: "MyProperty",
                emptyTargetDimensions,
                prop => prop.SetValueAsync("new value"));

            await coreActionExecutor.OnBeforeExecutingBatchAsync(new[] { project });

            bool propertyUpdated = await coreActionExecutor.ExecuteAsync(project);

            coreActionExecutor.OnAfterExecutingBatch();

            Assert.True(propertyUpdated);
            Assert.Equal(expected: 4, actual: affectedConfigs.Count);
            foreach (var configuration in projectConfigurations)
            {
                Assert.Contains(configuration.Name, affectedConfigs);
            }
        }
 public CacheKey(Type type, string name, IPropertyFactory propertyFactory)
 {
     Type            = type;
     Name            = name;
     PropertyFactory = propertyFactory;
 }
 /// <summary>
 /// Initialize a new instance of <see cref="PropertyBuilder"/>.
 /// </summary>
 /// <param name="factory">The <see cref="IPropertyFactory"/>.</param>
 public PropertyBuilder(IPropertyFactory factory)
 {
     _factory = factory ?? throw new ArgumentNullException(nameof(factory));
 }
Example #28
0
 public MainFacadeOfModelInstanceManager(IMfmimLocalContextProvider mfmimlocalcontextprovider)
 {
     mfmimLocalContextProvider = mfmimlocalcontextprovider;
     propertyFactory           = mfmimLocalContextProvider.GetPropertyFactory;
     modelManager = mfmimLocalContextProvider.GetModelManager;
 }
 /// <summary>
 /// Creates factory that caches <see cref="IProperty"/> for the same property type and name.
 /// </summary>
 /// <param name="propertyFactory">Factory.</param>
 /// <param name="maxItemCount">Max item count in cache.</param>
 /// <returns>New cached <see cref="IPropertyFactory"/>.</returns>
 public static IPropertyFactory Cached(this IPropertyFactory propertyFactory, int?maxItemCount = null)
 {
     return(new CachedPropertyFactory(propertyFactory, maxItemCount: maxItemCount));
 }
Example #30
0
 public abstract IProperty GetProperty(IPropertyFactory propertyType);
Example #31
0
 public ModificationDataCarrier(IPropertyFactory propertyfactory)
 {
     propertyFactory = propertyfactory;
     IsInitialized   = false;
 }
Example #32
0
 public abstract IProperty GetProperty(IPropertyFactory propertyType);
Example #33
0
 public override IProperty GetProperty(IPropertyFactory propertyType) => properties.FirstOrDefault(p => p.Type == propertyType) ?? new EmptyProperty();
Example #34
0
 public Board(IPropertyFactory propertyFactory)
 {
     Properties = propertyFactory.GenerateProperties();
 }
Example #35
0
        int F307_fzzz_CHAMPION_GetStatisticAdjustedAttack(ILiveEntity P642_ps_Champion, IPropertyFactory P643_ui_StatisticIndex, int P644_ui_Attack)
        {
            int L0927_i_Factor;

            if ((L0927_i_Factor = 170 - P642_ps_Champion.GetProperty(P643_ui_StatisticIndex).Value) < 16) //[C1_CURRENT]
            {
                /* BUG0_41 The Antifire and Antimagic statistics are completely ignored. The Vitality statistic is ignored against poison and to determine the probability of being wounded. Vitality is still used normally to compute the defense against wounds and the speed of health regeneration. A bug in the Megamax C compiler produces wrong machine code for this statement. It always returns 0 for the current statistic value so that L0927_i_Factor = 170 in all cases */
                return(P644_ui_Attack >> 3);
            }
            return(F030_aaaW_MAIN_GetScaledProduct(P644_ui_Attack, 7, L0927_i_Factor));
        }
 public Board(IPropertyFactory propertyFactory)
 {
     Properties = propertyFactory.GenerateProperties();
 }
Example #37
0
 public Properties(IPropertyFactory propertyFactory)
 {
     this.propertyFactory = propertyFactory;
 }
 internal Properties(IPropertyFactory propertyFactory)
 {
     this.propertyFactory = propertyFactory;
 }