public void should_match_defined_convention() { var blueprint = new CustomPropertyValueBlueprint(x => x.Name.Equals("HireDate"), () => DateTime.MaxValue); var matches = blueprint.Matches(new ConstruktionContext(typeof(Foo).GetProperty(nameof(Foo.HireDate)))); matches.ShouldBe(true); }
public void should_construct_from_value() { var blueprint = new CustomPropertyValueBlueprint(x => x.Name.Equals("HireDate"), () => DateTime.MaxValue); var result = blueprint.Construct(new ConstruktionContext(typeof(Foo).GetProperty(nameof(Foo.HireDate))), new DefaultConstruktionPipeline()); result.ShouldBeOfType <DateTime>().ShouldBe(DateTime.MaxValue); }
public void registry_should_add_multiple_blueprints() { var stringBlueprint = new CustomPropertyValueBlueprint(x => x.PropertyType == typeof(string), () => "x"); var intBlueprint = new CustomPropertyValueBlueprint(x => x.PropertyType == typeof(int), () => 1); var result = construktion.Apply(x => x.AddBlueprints(new List <Blueprint> { stringBlueprint, intBlueprint })).Construct <Foo>(); result.String.ShouldBe("x"); result.Int.ShouldBe(1); }