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); }
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 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 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]); }
public void WhenTheEntityIsCreated_TheProviderStateIsTheExpectedType() { var properties = PropertiesAvailableStatusFactory.CreateUIPropertyPropertiesAvailableStatus(); var context = IQueryExecutionContextFactory.Create(); var id = new EntityIdentity(key: "PropertyName", value: "A"); var cache = IProjectStateFactory.Create(); var property = new TestProperty { Name = "A" }; var rule = new Rule(); rule.BeginInit(); rule.Properties.Add(property); rule.EndInit(); var result = (UIPropertyValue)UIPropertyDataProducer.CreateUIPropertyValue(context, id, cache, QueryProjectPropertiesContext.ProjectFile, property, order: 42, requestedProperties: properties); Assert.IsType <PropertyProviderState>(((IEntityValueFromProvider)result).ProviderState); }
public void WhenTheEntityIsCreated_TheProviderStateIsTheExpectedType() { var properties = PropertiesAvailableStatusFactory.CreateUIPropertyPropertiesAvailableStatus(); var runtimeModel = IEntityRuntimeModelFactory.Create(); var id = new EntityIdentity(key: "PropertyName", value: "A"); var cache = IPropertyPageQueryCacheFactory.Create(); var property = new TestProperty { Name = "A" }; var rule = new Rule(); rule.BeginInit(); rule.Properties.Add(property); rule.EndInit(); var result = (UIPropertyValue)UIPropertyDataProducer.CreateUIPropertyValue(runtimeModel, id, cache, property, order: 42, properties); Assert.IsType <PropertyProviderState>(((IEntityValueFromProvider)result).ProviderState); }