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"); }
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); }
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); }
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); }
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"); }