public void CreatePropertyValue()
        {
            var            factory       = PropertyValueFactory.CreatePropertyValue(typeof(string)).Compile();
            IPropertyValue propertyValue = factory.Invoke(new PropertyValueFactory(), new Property <string>("Name"), "Alex", ValueSource.Defined);

            propertyValue.Should().NotBeNull();
        }
        public void PropertyValueFactory_CreateUntyped()
        {
            var factory = new PropertyValueFactory();

            IPropertyValue propertyValue = factory.CreateUntyped(new Property <int>("Age"), 10, ValueSource.Defined);

            propertyValue.Should().NotBeNull();
            propertyValue.PropertyUntyped.Type.Should().Be(typeof(int));
            propertyValue.PropertyUntyped.Name.Should().Be("Age");
            propertyValue.ValueUntyped.Should().Be(10);
        }
Exemple #3
0
        public void get_property_value()
        {
            IPropertyContainer propertyContainer = new MutablePropertyContainer()
                                                   .WithValue(EntityMeta.CreatedAt, DateTime.Today)
                                                   .WithValue(EntityMeta.Description, "description");

            IPropertyValue <string>?propertyValue = propertyContainer.GetPropertyValue(EntityMeta.Description);

            propertyValue.Should().NotBeNull();
            propertyValue.Property.Should().BeSameAs(EntityMeta.Description);
            propertyValue.Value.Should().Be("description");
            propertyValue.Source.Should().Be(ValueSource.Defined);
        }