コード例 #1
0
    public void should_fail_if_more_than_one_constructor_matched()
    {
        // --arrange
        var target = new GetConstructorByInjectPointId(Subject.AmbiguousId);

        // --act
        Action actual = () => target.Process(new BuildSessionMock(Unit.IsType <Subject>().ToBuildChain()));

        // --assert
        actual.Should().ThrowExactly <ArmatureException>().Which.Message.Should().StartWith("More than one constructors of the type");
    }
コード例 #2
0
    public void should_return_no_constructor()
    {
        // --arrange
        var target = new GetConstructorByInjectPointId("bad-id");

        // --act
        var actual = new BuildSessionMock(Unit.IsType <Subject>().ToBuildChain());

        target.Process(actual);

        // --assert
        actual.BuildResult.HasValue.Should().BeFalse();
    }
コード例 #3
0
    public void should_find_marked_constructor_without_point_id_among_others()
    {
        // --arrange
        var target = new GetConstructorByInjectPointId();

        // --act
        var actual = new BuildSessionMock(Unit.IsType <Subject>().ToBuildChain());

        target.Process(actual);

        // --assert
        actual.BuildResult.Value.As <ConstructorInfo>().GetParameters().Single().ParameterType.Should().Be <byte>();
    }