Esempio n. 1
0
        public void WhenReadOnlyPropertyWithBackFieldMatch()
        {
            var pattern = new AlwaysAccessToFieldWhereAvailableApplier <IPropertyMapper>();
            var member  = ForClass <MyClass> .Property(x => x.ReadonlyPropWithField);

            pattern.Match(member).Should().Be.True();
        }
Esempio n. 2
0
        public void WhenPropertyWithoutFieldNoMatch()
        {
            var pattern = new AlwaysAccessToFieldWhereAvailableApplier <IPropertyMapper>();
            var member  = ForClass <MyClass> .Property(x => x.ReadonlyProp);

            pattern.Match(member).Should().Be.False();
        }
Esempio n. 3
0
        public void WhenFieldNoMatch()
        {
            var pattern = new AlwaysAccessToFieldWhereAvailableApplier <IPropertyMapper>();
            var member  = ForClass <MyClass> .Field("aField");

            pattern.Match(member).Should().Be.False();
        }
Esempio n. 4
0
        public void ApplierAlwaysField()
        {
            var mapper  = new Mock <IPropertyMapper>();
            var pattern = new AlwaysAccessToFieldWhereAvailableApplier <IPropertyMapper>();

            pattern.Apply(null, mapper.Object);
            mapper.Verify(x => x.Access(It.Is <Accessor>(a => a == Accessor.Field)));
        }