Esempio n. 1
0
        public void should_get_actual_and_specified_type()
        {
            var member = new MemberValue(new SimpleValue(new Model(), ModelType),
                new CachedMember(ModelType.Type.GetProperty("List")), x => false);

            member.SpecifiedType.Type.ShouldBe<IList>();
            member.ActualType.Type.ShouldBe<List<string>>();
        }
Esempio n. 2
0
        public void should_set_and_get_property_value()
        {
            var model = new Model();
            var value = new SimpleValue(model, ModelType);
            var member = new MemberValue(value, new CachedMember(ModelType.Type.GetProperty("Property")), x => false);

            member.Instance.ShouldBeNull();
            member.SpecifiedType.Type.ShouldBe<string>();
            member.ActualType.Type.ShouldBe<string>();

            member.Instance = "oh";
            member.Instance.ShouldEqual("oh");
            member.ActualType.Type.ShouldBe<string>();
            member.SpecifiedType.Type.ShouldBe<string>();
            model.Property.ShouldEqual("oh");

            model.Property = "hai";
            member.Instance.ShouldEqual("hai");
            member.ActualType.Type.ShouldBe<string>();
            member.SpecifiedType.Type.ShouldBe<string>();
            model.Property.ShouldEqual("hai");
        }
Esempio n. 3
0
        public void should_override_specified_type_with_actual_type()
        {
            var member = new MemberValue(new SimpleValue(new Model(), ModelType),
                new CachedMember(ModelType.Type.GetProperty("List")), x =>
                {
                    x.Type.ShouldBe<IList>();
                    return true;
                });

            member.SpecifiedType.Type.ShouldBe<List<string>>();
            member.ActualType.Type.ShouldBe<List<string>>();
        }