Exemplo n.º 1
0
        public void WhenPropertiesAreRequested_PropertyValuesAreReturned()
        {
            var properties = PropertiesAvailableStatusFactory.CreateUIPropertyPropertiesAvailableStatus(includeAllProperties: true);

            var context  = IQueryExecutionContextFactory.Create();
            var id       = new EntityIdentity(key: "PropertyName", value: "A");
            var cache    = IProjectStateFactory.Create();
            var property = new TestProperty
            {
                Name        = "A",
                DisplayName = "Page A",
                Description = "This is the description for Page A",
                HelpUrl     = "https://mypage",
                Category    = "general",
                Visible     = false,
                DataSource  = new DataSource {
                    HasConfigurationCondition = false
                }
            };

            InitializeFakeRuleForProperty(property);

            var result = (UIPropertyValue)UIPropertyDataProducer.CreateUIPropertyValue(context, id, cache, QueryProjectPropertiesContext.ProjectFile, property, order: 42, requestedProperties: properties);

            Assert.Equal(expected: "A", actual: result.Name);
            Assert.Equal(expected: "Page A", actual: result.DisplayName);
            Assert.Equal(expected: "This is the description for Page A", actual: result.Description);
            Assert.True(result.ConfigurationIndependent);
            Assert.Equal(expected: "general", actual: result.CategoryName);
            Assert.False(result.IsVisible);
            Assert.Equal(expected: 42, actual: result.Order);
            Assert.Equal(expected: "string", actual: result.Type);
        }
Exemplo n.º 2
0
        public void WhenCreatingCategoriesFromARule_OneEntityIsCreatedPerCategory()
        {
            var properties = PropertiesAvailableStatusFactory.CreateCategoryPropertiesAvailableStatus(includeAllProperties: true);

            var context      = IQueryExecutionContextFactory.Create();
            var parentEntity = IEntityWithIdFactory.Create(key: "A", value: "B");
            var rule         = new Rule
            {
                Categories =
                {
                    new()
                    {
                        Name        = "Alpha",
                        DisplayName = "First category"
                    },
                    new()
                    {
                        Name        = "Beta",
                        DisplayName = "Second category"
                    }
                }
            };

            var result = CategoryDataProducer.CreateCategoryValues(context, parentEntity, rule, properties);

            Assert.Collection(result, new Action <IEntityValue>[]
            {
                entity => { assertEqual(entity, expectedName: "Alpha", expectedDisplayName: "First category"); },
                entity => { assertEqual(entity, expectedName: "Beta", expectedDisplayName: "Second category"); }
            });
        public void WhenPropertiesAreRequested_PropertyValuesAreReturned()
        {
            var properties = PropertiesAvailableStatusFactory.CreateUIPropertyPropertiesAvailableStatus(includeAllProperties: true);

            var runtimeModel = IEntityRuntimeModelFactory.Create();
            var id           = new EntityIdentity(key: "PropertyName", value: "A");
            var cache        = IPropertyPageQueryCacheFactory.Create();
            var property     = new TestProperty
            {
                Name        = "A",
                DisplayName = "Page A",
                Description = "This is the description for Page A",
                HelpUrl     = "https://mypage",
                Category    = "general",
                DataSource  = new DataSource {
                    HasConfigurationCondition = false
                }
            };

            var result = (UIPropertyValue)UIPropertyDataProducer.CreateUIPropertyValue(runtimeModel, id, cache, property, order: 42, properties);

            Assert.Equal(expected: "A", actual: result.Name);
            Assert.Equal(expected: "Page A", actual: result.DisplayName);
            Assert.Equal(expected: "This is the description for Page A", actual: result.Description);
            Assert.True(result.ConfigurationIndependent);
            Assert.Equal(expected: "general", actual: result.CategoryName);
            Assert.Equal(expected: 42, actual: result.Order);
            Assert.Equal(expected: "string", actual: result.Type);
        }
        public async Task WhenPropertyIsAnIEvaluatedProperty_GetUnevaluatedValueAsyncIsCalled()
        {
            var properties = PropertiesAvailableStatusFactory.CreateUIPropertyValuePropertiesAvailableStatus(
                includeEvaluatedValue: false,
                includeUnevaluatedValue: true);

            var mockEvaluatedProperty = new Mock <IEvaluatedProperty>();

            mockEvaluatedProperty.Setup(m => m.GetUnevaluatedValueAsync()).ReturnsAsync("unevaluated value");
            var property = mockEvaluatedProperty.Object;

            var entityRuntime = IEntityRuntimeModelFactory.Create();
            var id            = new EntityIdentity(key: "A", value: "B");
            var configuration = ProjectConfigurationFactory.Create(configuration: "Alpha|Beta|Gamma");

            var result = (UIPropertyValueValue)await UIPropertyValueDataProducer.CreateUIPropertyValueValueAsync(
                entityRuntime,
                id,
                configuration,
                property,
                properties);

            Assert.Equal(expected: "unevaluated value", actual: result.UnevaluatedValue);
            mockEvaluatedProperty.Verify(m => m.GetUnevaluatedValueAsync());
        }
        public void WhenCreatingEditorsFromAProperty_OneEntityIsReturnedPerEditor()
        {
            var properties = PropertiesAvailableStatusFactory.CreateUIPropertyEditorPropertiesAvailableStatus(includeName: true);

            var parentEntity = IEntityWithIdFactory.Create(key: "parentKey", value: "parentId");
            var rule         = new Rule();

            rule.BeginInit();
            rule.Properties.Add(
                new TestProperty
            {
                Name         = "MyProperty",
                ValueEditors =
                {
                    new ValueEditor {
                        EditorType = "Alpha"
                    },
                    new ValueEditor {
                        EditorType = "Beta"
                    },
                    new ValueEditor {
                        EditorType = "Gamma"
                    }
                }
            });
            rule.EndInit();

            var results = UIPropertyEditorDataProducer.CreateEditorValues(parentEntity, rule, "MyProperty", properties);

            Assert.Collection(results, new Action <IEntityValue>[]
            {
                entity => assertEqual(entity, expectedName: "Alpha"),
                entity => assertEqual(entity, expectedName: "Beta"),
                entity => assertEqual(entity, expectedName: "Gamma")
            });
        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);
        }
Exemplo n.º 7
0
        public void WhenCreatingPropertiesFromARule_OneEntityIsCreatedPerProperty()
        {
            var properties = PropertiesAvailableStatusFactory.CreateUIPropertyPropertiesAvailableStatus(includeAllProperties: true);

            var context      = IQueryExecutionContextFactory.Create();
            var parentEntity = IEntityWithIdFactory.Create(key: "Parent", value: "ParentRule");
            var cache        = IProjectStateFactory.Create();
            var rule         = new Rule();

            rule.BeginInit();
            rule.Properties.AddRange(new[]
            {
                new TestProperty {
                    Name = "Alpha"
                },
                new TestProperty {
                    Name = "Beta"
                },
                new TestProperty {
                    Name = "Gamma"
                },
            });
            rule.EndInit();

            var result = UIPropertyDataProducer.CreateUIPropertyValues(context, parentEntity, cache, QueryProjectPropertiesContext.ProjectFile, rule, properties);

            Assert.Collection(result, new Action <IEntityValue>[]
            {
                entity => { assertEqual(entity, expectedName: "Alpha"); },
                entity => { assertEqual(entity, expectedName: "Beta"); },
                entity => { assertEqual(entity, expectedName: "Gamma"); }
            });
Exemplo n.º 8
0
        public void WhenPropertiesAreRequested_PropertyValuesAreReturned()
        {
            var properties = PropertiesAvailableStatusFactory.CreateSupportedValuesPropertiesAvailableStatus();

            var entityRuntime = IEntityRuntimeModelFactory.Create();
            var enumValue     = IEnumValueFactory.Create(displayName: "Hello", name: "MyValue");

            var result = (SupportedValueValue)SupportedValueDataProducer.CreateSupportedValue(entityRuntime, enumValue, properties);

            Assert.Equal(expected: "Hello", actual: result.DisplayName);
            Assert.Equal(expected: "MyValue", actual: result.Value);
        }
        public void WhenPropertiesAreRequested_PropertyValuesAreReturned()
        {
            var properties = PropertiesAvailableStatusFactory.CreateConfigurationDimensionAvailableStatus(includeAllProperties: true);

            var entityRuntime = IEntityRuntimeModelFactory.Create();
            var dimension     = new KeyValuePair <string, string>("AlphaDimension", "AlphaDimensionValue");

            var result = (ConfigurationDimensionValue)ConfigurationDimensionDataProducer.CreateProjectConfigurationDimension(entityRuntime, dimension, properties);

            Assert.Equal(expected: "AlphaDimension", actual: result.Name);
            Assert.Equal(expected: "AlphaDimensionValue", actual: result.Value);
        }
        public void WhenPropertiesAreNotRequested_PropertyValuesAreNotReturned()
        {
            var properties = PropertiesAvailableStatusFactory.CreateConfigurationDimensionAvailableStatus();

            var entityRuntime = IEntityRuntimeModelFactory.Create();
            var dimension     = new KeyValuePair <string, string>("AlphaDimension", "AlphaDimensionValue");

            var result = (ConfigurationDimensionValue)ConfigurationDimensionDataProducer.CreateProjectConfigurationDimension(entityRuntime, dimension, properties);

            Assert.Throws <MissingDataException>(() => result.Name);
            Assert.Throws <MissingDataException>(() => result.Value);
        }
Exemplo n.º 11
0
        public void WhenCreatingEntitiesFromAProjectConfiguration_OneEntityIsCreatedPerDimension()
        {
            var properties = PropertiesAvailableStatusFactory.CreateConfigurationDimensionAvailableStatus(includeAllProperties: true);

            var entityRuntimeModel = IEntityRuntimeModelFactory.Create();
            var configuration      = ProjectConfigurationFactory.Create("Alpha|Beta|Gamma", "A|B|C");
            var results            = ConfigurationDimensionDataProducer.CreateProjectConfigurationDimensions(entityRuntimeModel, configuration, 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 dimension && dimension.Name == "Alpha" && dimension.Value == "A");
            Assert.Contains(results, entity => entity is ConfigurationDimensionValue dimension && dimension.Name == "Beta" && dimension.Value == "B");
            Assert.Contains(results, entity => entity is ConfigurationDimensionValue dimension && dimension.Name == "Gamma" && dimension.Value == "C");
        }
        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);
        }
        public void WhenCreatingAnEntityFromAParentAndEditor_TheIdIsTheEditorType()
        {
            var properties = PropertiesAvailableStatusFactory.CreateUIPropertyEditorPropertiesAvailableStatus(includeName: false);

            var parentEntity = IEntityWithIdFactory.Create(key: "parentId", value: "aaa");
            var editor       = new ValueEditor {
                EditorType = "My.Editor.Type"
            };

            var result = (UIPropertyEditorValue)UIPropertyEditorDataProducer.CreateEditorValue(parentEntity, editor, properties);

            Assert.Equal(expected: "My.Editor.Type", actual: result.Id[ProjectModelIdentityKeys.EditorName]);
        }
        public void WhenPropertiesAreNotRequested_PropertyValuesAreNotReturned()
        {
            var properties = PropertiesAvailableStatusFactory.CreateUIEditorMetadataAvailableStatus(includeAllProperties: false);

            var entityRuntime = IEntityRuntimeModelFactory.Create();
            var metadata      = new NameValuePair {
                Name = "Alpha", Value = "AlphaValue"
            };

            var result = (UIEditorMetadataValue)UIEditorMetadataProducer.CreateMetadataValue(entityRuntime, metadata, properties);

            Assert.Throws <MissingDataException>(() => result.Name);
            Assert.Throws <MissingDataException>(() => result.Value);
        }
        public void WhenCreatingFromAParentAndRule_TheRuleNameIsTheEntityId()
        {
            var properties = PropertiesAvailableStatusFactory.CreatePropertyPagePropertiesAvailableStatus();

            var propertyPage = (PropertyPageValue)PropertyPageDataProducer.CreatePropertyPageValue(
                IEntityWithIdFactory.Create(key: "ParentKey", value: "ParentValue"),
                IPropertyPageQueryCacheFactory.Create(),
                new Rule {
                Name = "MyRule", DisplayName = "My Rule Display Name", Order = 42, PageTemplate = "generic"
            },
                properties);

            Assert.Equal(expected: "MyRule", actual: propertyPage.Id[ProjectModelIdentityKeys.PropertyPageName]);
        }
        public void WhenPropertiesAreRequested_PropertyValuesAreReturned()
        {
            var properties = PropertiesAvailableStatusFactory.CreateUIPropertyEditorPropertiesAvailableStatus(includeName: true);

            var context = IQueryExecutionContextFactory.Create();
            var id      = new EntityIdentity(key: "EditorKey", value: "bbb");
            var editor  = new ValueEditor {
                EditorType = "My.Editor.Type"
            };

            var result = (UIPropertyEditorValue)UIPropertyEditorDataProducer.CreateEditorValue(context, id, editor, properties);

            Assert.Equal(expected: "My.Editor.Type", actual: result.Name);
        }
        public void WhenAnEditorValueIsCreated_TheEditorIsTheProviderState()
        {
            var properties = PropertiesAvailableStatusFactory.CreateUIPropertyEditorPropertiesAvailableStatus(includeName: true);

            var context = IQueryExecutionContextFactory.Create();
            var id      = new EntityIdentity(key: "EditorKey", value: "bbb");
            var editor  = new ValueEditor {
                EditorType = "My.Editor.Type"
            };

            var result = (UIPropertyEditorValue)UIPropertyEditorDataProducer.CreateEditorValue(context, id, editor, properties);

            Assert.Equal(expected: editor, actual: ((IEntityValueFromProvider)result).ProviderState);
        }
        public void WhenCategoryValueCreated_TheCategoryIsTheProviderState()
        {
            var properties = PropertiesAvailableStatusFactory.CreateCategoryPropertiesAvailableStatus(includeAllProperties: true);

            var entityRuntime = IEntityRuntimeModelFactory.Create();
            var id            = new EntityIdentity(key: "A", value: "B");
            var category      = new Category {
                DisplayName = "CategoryDisplayName", Name = "CategoryName"
            };
            var order = 42;

            var result = (CategoryValue)CategoryDataProducer.CreateCategoryValue(entityRuntime, id, category, order, properties);

            Assert.Equal(expected: category, actual: ((IEntityValueFromProvider)result).ProviderState);
        }
        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"
            });
Exemplo n.º 20
0
        public void WhenCreatingAModel_ProviderStateIsTheCorrectType()
        {
            var properties = PropertiesAvailableStatusFactory.CreatePropertyPagePropertiesAvailableStatus(includeAllProperties: true);

            var propertyPage = (IEntityValueFromProvider)PropertyPageDataProducer.CreatePropertyPageValue(
                IEntityWithIdFactory.Create(key: "A", value: "B"),
                IPropertyPageQueryCacheFactory.Create(),
                new Rule {
                Name = "MyRule", DisplayName = "My Rule Display Name", Order = 42, PageTemplate = "generic"
            },
                debugChildRules: new List <Rule>(),
                properties);

            Assert.IsType <PropertyPageProviderState>(propertyPage.ProviderState);
        }
        public void WhenCreatingAModel_ProviderStateConsistsOfCacheAndRule()
        {
            var properties = PropertiesAvailableStatusFactory.CreatePropertyPagePropertiesAvailableStatus();

            var propertyPage = (IEntityValueFromProvider)PropertyPageDataProducer.CreatePropertyPageValue(
                IEntityRuntimeModelFactory.Create(),
                new EntityIdentity(key: "A", value: "B"),
                IPropertyPageQueryCacheFactory.Create(),
                new Rule {
                Name = "MyRule", DisplayName = "My Rule Display Name", Order = 42, PageTemplate = "generic"
            },
                properties);

            Assert.IsType <(IPropertyPageQueryCache, Rule)>(propertyPage.ProviderState);
        }
        public void WhenCategoryValueCreated_TheCategoryIsTheProviderState()
        {
            var properties = PropertiesAvailableStatusFactory.CreateCategoryPropertiesAvailableStatus(includeAllProperties: true);

            var parentEntity = IEntityWithIdFactory.Create(key: "Parent", value: "KeyValue");
            var rule         = new Rule();
            var category     = new Category {
                DisplayName = "CategoryDisplayName", Name = "CategoryName"
            };
            var order = 42;

            var result = (CategoryValue)CategoryDataProducer.CreateCategoryValue(parentEntity, rule, category, order, properties);

            Assert.Equal(expected: category, actual: ((IEntityValueFromProvider)result).ProviderState);
        }
        public void WhenCreatingACategory_TheIdIsTheCategoryName()
        {
            var properties = PropertiesAvailableStatusFactory.CreateCategoryPropertiesAvailableStatus(includeAllProperties: true);

            var parentEntity = IEntityWithIdFactory.Create(key: "A", value: "B");
            var category     = new Category {
                DisplayName = "CategoryDisplayName", Name = "MyCategoryName"
            };
            var order = 42;

            var result = (CategoryValue)CategoryDataProducer.CreateCategoryValue(parentEntity, category, order, properties);

            Assert.True(result.Id.TryGetValue(ProjectModelIdentityKeys.CategoryName, out string name));
            Assert.Equal(expected: "MyCategoryName", actual: name);
        }
        public void WhenCreatingFromAParentAndProperty_ThePropertyNameIsTheEntityId()
        {
            var properties = PropertiesAvailableStatusFactory.CreateUIPropertyPropertiesAvailableStatus();

            var parentEntity = IEntityWithIdFactory.Create(key: "parent", value: "A");
            var cache        = IPropertyPageQueryCacheFactory.Create();
            var property     = new TestProperty {
                Name = "MyProperty"
            };
            var order = 42;

            var result = (UIPropertyValue)UIPropertyDataProducer.CreateUIPropertyValue(parentEntity, cache, property, order, properties);

            Assert.Equal(expected: "MyProperty", actual: result.Id[ProjectModelIdentityKeys.UIPropertyName]);
        }
        public void WhenCreatingAModel_ProviderStateIsTheCorrectType()
        {
            var properties = PropertiesAvailableStatusFactory.CreatePropertyPagePropertiesAvailableStatus(includeAllProperties: true);

            var propertyPage = (IEntityValueFromProvider)PropertyPageDataProducer.CreatePropertyPageValue(
                IQueryExecutionContextFactory.Create(),
                IEntityWithIdFactory.Create(key: "A", value: "B"),
                IProjectStateFactory.Create(),
                QueryProjectPropertiesContext.ProjectFile,
                new Rule {
                Name = "MyRule", DisplayName = "My Rule Display Name", Order = 42, PageTemplate = "generic"
            },
                requestedProperties: properties);

            Assert.IsType <ContextAndRuleProviderState>(propertyPage.ProviderState);
        }
        public void WhenCreatingFromAParentAndRule_TheRuleNameIsTheEntityId()
        {
            var properties = PropertiesAvailableStatusFactory.CreatePropertyPagePropertiesAvailableStatus(includeAllProperties: true);

            var propertyPage = (PropertyPageValue)PropertyPageDataProducer.CreatePropertyPageValue(
                IQueryExecutionContextFactory.Create(),
                IEntityWithIdFactory.Create(key: "ParentKey", value: "ParentValue"),
                IProjectStateFactory.Create(),
                QueryProjectPropertiesContext.ProjectFile,
                new Rule {
                Name = "MyRule", DisplayName = "My Rule Display Name", Order = 42, PageTemplate = "generic"
            },
                requestedProperties: properties);

            Assert.Equal(expected: "MyRule", actual: propertyPage.Id[ProjectModelIdentityKeys.PropertyPageName]);
        }
        public void WhenPropertiesAreRequested_PropertyValuesAreReturned()
        {
            var properties = PropertiesAvailableStatusFactory.CreateUIEditorMetadataAvailableStatus(
                includeName: true,
                includeValue: true);

            var entityRuntime = IEntityRuntimeModelFactory.Create();
            var metadata      = new NameValuePair {
                Name = "Alpha", Value = "AlphaValue"
            };

            var result = (UIEditorMetadataValue)UIEditorMetadataProducer.CreateMetadataValue(entityRuntime, metadata, properties);

            Assert.Equal(expected: "Alpha", actual: result.Name);
            Assert.Equal(expected: "AlphaValue", actual: result.Value);
        }
        public void WhenPropertiesAreRequested_PropertyValuesAreReturned()
        {
            var properties = PropertiesAvailableStatusFactory.CreateCategoryPropertiesAvailableStatus(includeAllProperties: true);

            var parentEntity = IEntityWithIdFactory.Create(key: "Parent", value: "KeyValue");
            var rule         = new Rule();
            var category     = new Category {
                DisplayName = "CategoryDisplayName", Name = "CategoryName"
            };
            var order = 42;

            var result = (CategoryValue)CategoryDataProducer.CreateCategoryValue(parentEntity, rule, category, order, properties);

            Assert.Equal(expected: "CategoryDisplayName", actual: result.DisplayName);
            Assert.Equal(expected: "CategoryName", actual: result.Name);
            Assert.Equal(expected: 42, actual: result.Order);
        }
        public void WhenPropertiesAreRequested_PropertyValuesAreReturned()
        {
            var properties = PropertiesAvailableStatusFactory.CreateCategoryPropertiesAvailableStatus(includeAllProperties: true);

            var entityRuntime = IEntityRuntimeModelFactory.Create();
            var id            = new EntityIdentity(key: "A", value: "B");
            var category      = new Category {
                DisplayName = "CategoryDisplayName", Name = "CategoryName"
            };
            var order = 42;

            var result = (CategoryValue)CategoryDataProducer.CreateCategoryValue(entityRuntime, id, category, order, properties);

            Assert.Equal(expected: "CategoryDisplayName", actual: result.DisplayName);
            Assert.Equal(expected: "CategoryName", actual: result.Name);
            Assert.Equal(expected: 42, actual: result.Order);
        }
Exemplo n.º 30
0
        public void WhenCreatingFromAParentAndProperty_ThePropertyNameIsTheEntityId()
        {
            var properties = PropertiesAvailableStatusFactory.CreateUIPropertyPropertiesAvailableStatus();

            var context      = IQueryExecutionContextFactory.Create();
            var parentEntity = IEntityWithIdFactory.Create(key: "parent", value: "A");
            var cache        = IProjectStateFactory.Create();
            var property     = new TestProperty {
                Name = "MyProperty"
            };
            var order = 42;

            InitializeFakeRuleForProperty(property);

            var result = (UIPropertyValue)UIPropertyDataProducer.CreateUIPropertyValue(context, parentEntity, cache, QueryProjectPropertiesContext.ProjectFile, property, order, properties);

            Assert.Equal(expected: "MyProperty", actual: result.Id[ProjectModelIdentityKeys.UIPropertyName]);
        }