Exemplo n.º 1
0
        public void GetAccessor_returns_null_when_property_is_not_bindable()
        {
            var res     = new TypePropertyAccessor(typeof(ClassWithAttributes));
            var accesor = res.GetAccessor(nameof(ClassWithAttributes.NotBindable));

            accesor.Should().BeNull();
        }
Exemplo n.º 2
0
        public void GetAccessor_returns_null_use_bindable_direction_for_settable_value(string propertyName, bool settable)
        {
            var res     = new TypePropertyAccessor(typeof(ClassWithAttributes));
            var accesor = res.GetAccessor(propertyName);

            accesor.IsSettable.Should().Be(settable);
        }
Exemplo n.º 3
0
        public void GetAccessor_returns_correct_object(Type type, string propertyName)
        {
            var res     = new TypePropertyAccessor(type);
            var accesor = res.GetAccessor(propertyName);

            accesor.Name.Should().Be(propertyName);
        }
Exemplo n.º 4
0
        public void GetAccessor_returns_null_when_property_not_found(Type type, string propertyName)
        {
            var res     = new TypePropertyAccessor(type);
            var accesor = res.GetAccessor(propertyName);

            accesor.Should().BeNull();
        }
Exemplo n.º 5
0
        public void HasReadWriteProperties_returns_correct_property(Type type, bool expectedHasReadWriteProperties)
        {
            var res = new TypePropertyAccessor(type);

            res.HasReadWriteProperties.Should().Be(expectedHasReadWriteProperties);
        }
Exemplo n.º 6
0
        public void ReadProperties_returns_correct_property_position(Type type, int[] positions)
        {
            var res = new TypePropertyAccessor(type);

            res.ReadProperties.Select(prop => prop.Position).Should().BeEquivalentTo(positions);
        }
Exemplo n.º 7
0
        public void ReadProperties_returns_correct_property_name(Type type, string[] properties)
        {
            var res = new TypePropertyAccessor(type);

            res.ReadProperties.Select(prop => prop.Name).Should().BeEquivalentTo(properties);
        }
Exemplo n.º 8
0
        public void AttributeNames_returns_correct_property(Type type, string[] properties)
        {
            var res = new TypePropertyAccessor(type);

            res.AttributeNames.Should().BeEquivalentTo(properties);
        }
Exemplo n.º 9
0
        public void Observability_returns_correct_property(Type type, ObjectObservability expected)
        {
            var res = new TypePropertyAccessor(type);

            res.Observability.Should().Be(expected);
        }