public void should_use_tag_for_property_argument_by_inject_point() { const string tag = "tag"; const string expected = "expectedString"; const string bad = expected + "bad"; // --arrange var target = CreateTarget(); target.Treat <string>().AsInstance(bad); target.Treat <string>(tag).AsInstance(expected); target .Treat <Subject>() .AsIs() .UsingArguments(ForProperty.WithInjectPoint(Subject.InjectPointId).UseTag(tag)); // --act var actual = target.Build <Subject>() !; // --assert actual.Should().NotBeNull(); actual.InjectProperty.Should().Be(expected); actual.StringProperty.Should().BeNull(); }
public void should_use_inject_point_id_as_token_for_property_by_inject_point() { const string expected = "expectedString"; // --arrange var target = CreateTarget(); target.Treat <string>(Subject.InjectPointId).AsInstance(expected); target .Treat <Subject>() .AsIs() .InjectProperty(ForProperty.WithInjectPoint(Subject.InjectPointId).UseInjectPointIdAsToken()); // --act var actual = target.Build <Subject>(); // --assert actual.Should().NotBeNull(); actual.InjectProperty.Should().Be(expected); actual.StringProperty.Should().BeNull(); }