public CartRuleProvider(IRuleFactory ruleFactory, IComponentContext componentContext, ICommonServices services) : base(RuleScope.Cart) { _ruleFactory = ruleFactory; _componentContext = componentContext; _services = services; }
public AlarmDetectRuleExecutor( IRuleFactory<int>[] ruleFactory, IRuleEngineFactory<int> engineFactory) { _engineFactory = engineFactory; RuleFactory = ruleFactory; }
/// <summary> /// Default constructor of the class,which will define the correct configration of rule factory and neighbourrule factory. /// </summary> /// <param name="grid">collectiion of cells</param> /// <param name="ruleFactory"> Factory to create rule. </param> /// <param name="neighbourRule">Factory to create neighbour rule.</param> public GameOfLife(ICellCollection grid, IRuleFactory ruleFactory, INeighbourRuleFactory neighbouruleFactory) { this.generationNumber = 1; this.grid = grid; this.ruleFactory = ruleFactory; this.neighbouruleFactory = neighbouruleFactory; }
private static IPropertyPagesCatalogProvider GetCatalogProviderAndData() { var betaPage = IRuleFactory.Create( name: "BetaCommandPageId", displayName: "Beta", pageTemplate: "CommandNameBasedDebugger", metadata: new Dictionary <string, object> { { "CommandName", "BetaCommand" } }); var gammaPage = IRuleFactory.Create( name: "GammaCommandPageId", displayName: "Gamma", pageTemplate: "CommandNameBasedDebugger", metadata: new Dictionary <string, object> { { "CommandName", "GammaCommand" } }); var catalog = IPropertyPagesCatalogFactory.Create( new Dictionary <string, IRule> { { "BetaPage", betaPage }, { "GammaPage", gammaPage } }); var catalogProvider = IPropertyPagesCatalogProviderFactory.Create( new Dictionary <string, IPropertyPagesCatalog> { { "Project", catalog } }); return(catalogProvider); }
public RuleController( IRuleFactory ruleFactory, IRuleStorage ruleStorage, IRuleTemplateSelector ruleTemplateSelector, Func <RuleScope, IRuleProvider> ruleProvider, IEnumerable <IRuleOptionsProvider> ruleOptionsProviders, Lazy <IPaymentService> paymentService, Lazy <PluginMediator> pluginMediator, Lazy <IMediaService> mediaService, AdminAreaSettings adminAreaSettings, Lazy <CustomerSettings> customerSettings, Lazy <MediaSettings> mediaSettings) { _ruleFactory = ruleFactory; _ruleStorage = ruleStorage; _ruleTemplateSelector = ruleTemplateSelector; _ruleProvider = ruleProvider; _ruleOptionsProviders = ruleOptionsProviders; _paymentService = paymentService; _pluginMediator = pluginMediator; _mediaService = mediaService; _adminAreaSettings = adminAreaSettings; _customerSettings = customerSettings; _mediaSettings = mediaSettings; }
public void builder() { _filesystem = Substitute.For<IFileSystem>(); _filesystem.GetPlatformRoot().Returns(The.Root); _filesystem.Exists(null).ReturnsForAnyArgs(true); _modules = Substitute.For<IModules>(); _modules.Paths.Returns(new[] { "group1/proj1", "group1/proj2", "group2/proj3" }); _modules.Repos.Returns(new[] { "p1Repo", "p2Repo", "p3Repo" }); _locks = new List<AutoResetEvent> { new AutoResetEvent(true), new AutoResetEvent(true), new AutoResetEvent(true) }; _modules.CreateAndSetLocks().Returns(_locks); _patterns = new Patterns { DependencyPattern = "*.dll", DependencyPath = (FilePath)"lib", Masters = new FilePath[] { } }; _git = Substitute.For<IGit>(); _depMgr = Substitute.For<IDependencyManager>(); _ruleFac = Substitute.For<IRuleFactory>(); _ruleFac.GetModules().Returns(_modules); _ruleFac.GetRulePatterns().Returns(_patterns); _buildCmd = Substitute.For<IBuildCmd>(); _subject = new Builder(_filesystem, _git, _depMgr, _ruleFac, _buildCmd); _subject.Prepare(); _subject.GetDependenciesAndBuild(); }
internal InMemoryProviderRulesDataSource( IInMemoryRulesStorage <TContentType, TConditionType> inMemoryRulesStorage, IRuleFactory <TContentType, TConditionType> ruleFactory) { this.inMemoryRulesStorage = inMemoryRulesStorage ?? throw new ArgumentNullException(nameof(inMemoryRulesStorage)); this.ruleFactory = ruleFactory ?? throw new ArgumentNullException(nameof(ruleFactory)); }
public LowAlarmRuleExecutor( IRuleFactory<double>[] ruleFactory, IRuleEngineFactory<double> engineFactory) { _engineFactory = engineFactory; RuleFactory = ruleFactory; }
public async Task UpdateRuleAsync_GivenNullRule_ThrowsArgumentNullException() { // Arrange Rule <ContentType, ConditionType> rule = null; IInMemoryRulesStorage <ContentType, ConditionType> inMemoryRulesStorage = Mock.Of <IInMemoryRulesStorage <ContentType, ConditionType> >(); IRuleFactory <ContentType, ConditionType> ruleFactory = Mock.Of <IRuleFactory <ContentType, ConditionType> >(); Mock.Get(ruleFactory) .Setup(x => x.CreateRule(rule)) .Verifiable(); Mock.Get(inMemoryRulesStorage) .Setup(x => x.UpdateRule(It.IsAny <RuleDataModel <ContentType, ConditionType> >())) .Verifiable(); InMemoryProviderRulesDataSource <ContentType, ConditionType> inMemoryProviderRulesDataSource = new InMemoryProviderRulesDataSource <ContentType, ConditionType>(inMemoryRulesStorage, ruleFactory); // Act ArgumentNullException argumentNullException = await Assert.ThrowsAsync <ArgumentNullException>(async() => await inMemoryProviderRulesDataSource.UpdateRuleAsync(rule).ConfigureAwait(false) ).ConfigureAwait(false); // Assert argumentNullException.Should().NotBeNull(); argumentNullException.ParamName.Should().Be(nameof(rule)); }
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); }
public HighWarningRuleExecutor( IRuleFactory<double>[] ruleFactory, IRuleEngineFactory<double> engineFactory) { _engineFactory = engineFactory; RuleFactory = ruleFactory; }
public async Task AddRuleAsync_GivenRule_ConvertsToRuleDataModelAndAddsToDataSource() { // Arrange Rule <ContentType, ConditionType> rule = new Rule <ContentType, ConditionType>(); RuleDataModel <ContentType, ConditionType> ruleDataModel = new RuleDataModel <ContentType, ConditionType>(); IInMemoryRulesStorage <ContentType, ConditionType> inMemoryRulesStorage = Mock.Of <IInMemoryRulesStorage <ContentType, ConditionType> >(); IRuleFactory <ContentType, ConditionType> ruleFactory = Mock.Of <IRuleFactory <ContentType, ConditionType> >(); Mock.Get(ruleFactory) .Setup(x => x.CreateRule(rule)) .Returns(ruleDataModel) .Verifiable(); Mock.Get(inMemoryRulesStorage) .Setup(x => x.AddRule(ruleDataModel)) .Verifiable(); InMemoryProviderRulesDataSource <ContentType, ConditionType> inMemoryProviderRulesDataSource = new InMemoryProviderRulesDataSource <ContentType, ConditionType>(inMemoryRulesStorage, ruleFactory); // Act await inMemoryProviderRulesDataSource.AddRuleAsync(rule).ConfigureAwait(false); // Assert Mock.VerifyAll(Mock.Get(inMemoryRulesStorage), Mock.Get(ruleFactory)); }
public void builder() { _filesystem = Substitute.For<IFileSystem>(); _filesystem.GetPlatformRoot().Returns(The.Root); var dbpath = The.Root.Navigate((FilePath)"group1/proj2/DatabaseScripts"); _filesystem.Exists(null).ReturnsForAnyArgs(c=> c.Args()[0] as FilePath == dbpath); _filesystem.SortedDescendants(null,null).ReturnsForAnyArgs(new [] {(FilePath)"one",(FilePath)"two"}); _modules = Substitute.For<IModules>(); _modules.Paths.Returns(new[] {"group1/proj1", "group1/proj2", "group2/proj3"}); _modules.Repos.Returns(new[] {"p1Repo", "p2Repo", "p3Repo"}); _locks = new List<AutoResetEvent> { new AutoResetEvent(true), new AutoResetEvent(true), new AutoResetEvent(true) }; _modules.CreateAndSetLocks().Returns(_locks); _git = Substitute.For<IGit>(); _depMgr = Substitute.For<IDependencyManager>(); _ruleFac = Substitute.For<IRuleFactory>(); _ruleFac.GetModules().Returns(_modules); _buildCmd = Substitute.For<IBuildCmd>(); _subject = new Builder(_filesystem, _git, _depMgr, _ruleFac, _buildCmd); _subject.Prepare(); _subject.RebuildDatabases(); }
public Builder(IFileSystem files, IGit git, IDependencyManager depMgr, IRuleFactory rules, IBuildCmd builder) { _files = files; _git = git; _depMgr = depMgr; _rules = rules; _builder = builder; }
public RuleEngine(ConcurrentBag <string> resultBag, ConcurrentDictionary <Data, ConcurrentBag <RuleInfo> > failedResultSet) { RuleFactory = Helper.RuleFactory.Instance; _failedResultBag = resultBag; _failedResultSet = failedResultSet; Rules = new ConcurrentDictionary <ValueTypes, ConcurrentBag <IRule> >(); }
public RulesLoader(IRuleFactory ruleFactory, IOutput output) { _ruleFactory = ruleFactory; _output = output; _deserializer = new DeserializerBuilder() .WithNamingConvention(CamelCaseNamingConvention.Instance) .Build(); }
public RuleProvider(IRuleFactory ruleFactory) { if (ruleFactory == null) { throw new ArgumentNullException(nameof(ruleFactory)); } this.RuleFactory = ruleFactory; }
public TargetGroupService( IRuleFactory ruleFactory, IRepository <Customer> rsCustomer, ICommonServices services) : base(RuleScope.Customer) { _ruleFactory = ruleFactory; _rsCustomer = rsCustomer; _services = services; }
public ProductRuleEvaluatorTask( IRepository <Category> categoryRepository, IRepository <ProductCategory> productCategoryRepository, IRuleFactory ruleFactory, IProductRuleProvider productRuleProvider) { _categoryRepository = categoryRepository; _productCategoryRepository = productCategoryRepository; _ruleFactory = ruleFactory; _productRuleProvider = productRuleProvider; }
public void Ctor_GivenNullParameters_ThrowsArgumentNullException(object param1, object param2) { // Arrange IInMemoryRulesStorage <ContentType, ConditionType> inMemoryRulesStorage = param1 as IInMemoryRulesStorage <ContentType, ConditionType>; IRuleFactory <ContentType, ConditionType> ruleFactory = param2 as IRuleFactory <ContentType, ConditionType>; // Act ArgumentNullException argumentNullException = Assert.Throws <ArgumentNullException>(() => new InMemoryProviderRulesDataSource <ContentType, ConditionType>(inMemoryRulesStorage, ruleFactory)); //Assert argumentNullException.Should().NotBeNull(); argumentNullException.ParamName.Should().BeOneOf(nameof(inMemoryRulesStorage), nameof(ruleFactory)); }
public CustomerRolesAssignmentsTask( IRepository <CustomerRole> customerRoleRepository, IRepository <CustomerRoleMapping> customerRoleMappingRepository, IRuleFactory ruleFactory, ITargetGroupService targetGroupService, ICacheManager cacheManager) { _customerRoleRepository = customerRoleRepository; _customerRoleMappingRepository = customerRoleMappingRepository; _ruleFactory = ruleFactory; _targetGroupService = targetGroupService; _cacheManager = cacheManager; }
internal MongoDbProviderRulesDataSource( IMongoClient mongoClient, MongoDbProviderSettings mongoDbProviderSettings, IRuleFactory <TContentType, TConditionType> ruleFactory) { if (mongoClient is null) { throw new ArgumentNullException(nameof(mongoClient)); } this.mongoDbProviderSettings = mongoDbProviderSettings ?? throw new ArgumentNullException(nameof(mongoDbProviderSettings)); this.ruleFactory = ruleFactory ?? throw new ArgumentNullException(nameof(ruleFactory)); this.mongoDatabase = mongoClient.GetDatabase(this.mongoDbProviderSettings.DatabaseName); }
public CreateRuleService( ICreateRuleValidator createRuleValidator, IConditionNodeAbstractFactory conditionNodeAbstractFactory, IConditionTypeRepository conditionTypeRepository, IContentTypeRepository contentTypeRepository, IRuleFactory ruleFactory, IRuleRepository ruleRepository, ITenantRepository tenantRepository) { this.createRuleValidator = createRuleValidator; this.conditionNodeAbstractFactory = conditionNodeAbstractFactory; this.conditionTypeRepository = conditionTypeRepository; this.contentTypeRepository = contentTypeRepository; this.ruleFactory = ruleFactory; this.ruleRepository = ruleRepository; this.tenantRepository = tenantRepository; }
public RuleController( IRuleFactory ruleFactory, IRuleStorage ruleStorage, ITargetGroupService targetGroupService, IRuleTemplateSelector ruleTemplateSelector, Func <RuleScope, IRuleProvider> ruleProvider, IEnumerable <IRuleOptionsProvider> ruleOptionsProviders, AdminAreaSettings adminAreaSettings) { _ruleFactory = ruleFactory; _ruleStorage = ruleStorage; _targetGroupService = targetGroupService; _ruleTemplateSelector = ruleTemplateSelector; _ruleProvider = ruleProvider; _ruleOptionsProviders = ruleOptionsProviders; _adminAreaSettings = adminAreaSettings; }
public ProductRuleProvider( Lazy <IRepository <ProductAttribute> > productAttributeRepository, Lazy <IRepository <SpecificationAttribute> > specificationAttributeRepository, IRuleFactory ruleFactory, ICommonServices services, ICatalogSearchService catalogSearchService, ICategoryService categoryService, IPluginFinder pluginFinder, CatalogSettings catalogSettings) : base(RuleScope.Product) { _productAttributeRepository = productAttributeRepository; _specificationAttributeRepository = specificationAttributeRepository; _ruleFactory = ruleFactory; _services = services; _catalogSearchService = catalogSearchService; _categoryService = categoryService; _pluginFinder = pluginFinder; _catalogSettings = catalogSettings; }
public void builder() { _filesystem = Substitute.For<IFileSystem>(); _filesystem.GetPlatformRoot().Returns(The.Root); _missingRepo = The.Root.Append((FilePath)"/group1/proj2"); _filesystem.Exists(null).ReturnsForAnyArgs(c=> (c.Args()[0] as FilePath !=_missingRepo)); _modules = Substitute.For<IModules>(); _modules.Paths.Returns(new[] {"group1/proj1", "group1/proj2", "group2/proj3"}); _modules.Repos.Returns(new[] {"p1Repo", "p2Repo", "p3Repo"}); _git = Substitute.For<IGit>(); _depMgr = Substitute.For<IDependencyManager>(); _ruleFac = Substitute.For<IRuleFactory>(); _ruleFac.GetModules().Returns(_modules); _subject = new Builder(_filesystem, _git, _depMgr, _ruleFac, null); _subject.Prepare(); }
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); }
public void builder() { _filesystem = Substitute.For<IFileSystem>(); _filesystem.GetPlatformRoot().Returns(The.Root); _filesystem.Exists(null).ReturnsForAnyArgs(c=> (c.Args()[0] as FilePath != (FilePath)"group1/proj2")); _modules = Substitute.For<IModules>(); _modules.Paths.Returns(new[] {"group1/proj1", "group1/proj2", "group2/proj3"}); _modules.Repos.Returns(new[] {"p1Repo", "p2Repo", "p3Repo"}); _locks = new List<AutoResetEvent> { new AutoResetEvent(false), new AutoResetEvent(false), new AutoResetEvent(false) }; _modules.CreateAndSetLocks().Returns(_locks); _git = Substitute.For<IGit>(); _depMgr = Substitute.For<IDependencyManager>(); _ruleFac = Substitute.For<IRuleFactory>(); _ruleFac.GetModules().Returns(_modules); _subject = new Builder(_filesystem, _git, _depMgr, _ruleFac, null); _subject.Prepare(); _subject.PullRepos(); }
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); } }
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); }
public FakeDataPluginControl( IEventAggregator eventAggregator, IRuleFactory ruleFactory, IRuleEditView ruleEditView, IRulePreviewView rulePreviewView, IRulesTreeView rulesTreeView, IServiceLocator containerGetter) { InitializeComponent(); containerGetter.RegisterOrganizationServiceFactory(() => Service); var rulesTreeViewControl = rulesTreeView.ToControl(); this.tableLayoutPanel1.Controls.Add(rulesTreeViewControl, 0, 0); rulesTreeViewControl.Dock = DockStyle.Fill; var ruleEditControl = ruleEditView.ToControl(); this.tableLayoutPanel1.Controls.Add(ruleEditControl); ruleEditControl.Dock = DockStyle.Fill; var rulePreviewControl = rulePreviewView.ToControl(); this.scMain.Panel2.Controls.Add(rulePreviewControl); rulePreviewControl.Dock = DockStyle.Fill; this.eventAggregator = eventAggregator; // TODO: ten rule factory jeszcze stąd wywalić jakos this.ruleFactory = ruleFactory; this.ruleEditView = ruleEditView; this.rulesTreeView = rulesTreeView; this.containerGetter = containerGetter; var rootRule = this.ruleFactory.Create(); rulesTreeView.AddRoot(rootRule.View); }
public CartPriceRuleService(ICartPriceRuleRepository cartPriceRuleRepository, IRuleFactory ruleFactory) { _cartPriceRuleRepository = cartPriceRuleRepository; _ruleFactory = ruleFactory; }
public RuleProvider(IRuleFactory ruleFactory) { this.ruleFactory = ruleFactory; FillNameToRule(); }
public GameController(IRuleFactory ruleFactory) { _generationUpdater = new GenerationUpdater(ruleFactory.GetRules()); }
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); }
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 GenericValidator(IRuleFactory <T> ruleFactory) { _rules = ruleFactory.BuildRules(); }
public TargetGroupFilterDescriptor(IRuleFactory ruleFactory, IRuleVisitor ruleVisitor) : base(x => true) { _ruleFactory = ruleFactory; _ruleVisitor = new WeakReference <IRuleVisitor>(ruleVisitor); }
public MoveValidator(IBoard board, IRuleFactory <MoveInfo> ruleFactory) { _board = board; _ruleFactory = ruleFactory; }