Beispiel #1
0
        public void should_construct_from_attribute_value()
        {
            var blueprint = new SetBlueprint();
            var property  = typeof(Foo).GetProperty("WithSet");
            var context   = new ConstruktionContext(property);

            var result = (string)blueprint.Construct(context, Default.Pipeline);

            result.ShouldBe("Set");
        }
Beispiel #2
0
        public void property_without_attribute_should_not_match()
        {
            var blueprint = new SetBlueprint();
            var property  = typeof(Foo).GetProperty("WithoutSet");
            var context   = new ConstruktionContext(property);

            var matches = blueprint.Matches(context);

            matches.ShouldBe(false);
        }
Beispiel #3
0
        public void should_match_property_with_attribute()
        {
            var blueprint = new SetBlueprint();
            var property  = typeof(Foo).GetProperty("WithSet");
            var context   = new ConstruktionContext(property);

            var matches = blueprint.Matches(context);

            matches.ShouldBe(true);
        }
Beispiel #4
0
        public void should_match_paramater_with_attribute()
        {
            var blueprint     = new SetBlueprint();
            var parameterInfo = typeof(ParameterAttributeBlueprintTests)
                                .GetMethod(nameof(TestMethod), BindingFlags.NonPublic | BindingFlags.Instance)
                                .GetParameters()[0];

            var matches = blueprint.Matches(new ConstruktionContext(parameterInfo));

            matches.ShouldBe(true);
        }
Beispiel #5
0
        public void should_construct_from_attribute()
        {
            var blueprint     = new SetBlueprint();
            var parameterInfo = typeof(ParameterAttributeBlueprintTests)
                                .GetMethod(nameof(TestMethod), BindingFlags.NonPublic | BindingFlags.Instance)
                                .GetParameters()[0];

            var result = blueprint.Construct(new ConstruktionContext(parameterInfo), new DefaultConstruktionPipeline());

            result.ShouldBe("Set");
        }