Beispiel #1
0
    public void AsCreated([Values(null, "tag")] object?tag)
    {
        var expectedType   = typeof(List <>);
        var expectedAction = new RedirectOpenGenericType(expectedType, tag);
        var expectedChild  = new IfFirstUnit(new IsGenericOfDefinition(expectedType, tag))
                             .UseBuildAction(Default.CreationBuildAction, BuildStage.Create);

        // --arrange
        var actual = new Util.TestBuildChainPattern();
        var target = new TreatingOpenGenericTuner(actual);

        // --act
        target.AsCreated(expectedType, tag);

        // --assert
        actual.BuildActions.Should()
        .HaveCount(1)
        .And.ContainKey(BuildStage.Create)
        .And.Subject.Values.Single()
        .Should()
        .HaveCount(1)
        .And.Contain(expectedAction);

        actual.Children.Single().Should().BeEquivalentTo(expectedChild);
    }
Beispiel #2
0
    public void AsIs()
    {
        var expectedAction = Default.CreationBuildAction;

        // --arrange
        var actual = new Util.TestBuildChainPattern();
        var target = new TreatingOpenGenericTuner(actual);

        // --act
        target.AsIs();

        // --assert
        actual.BuildActions.Should()
        .HaveCount(1)
        .And.ContainKey(BuildStage.Create)
        .And.Subject.Values.Single()
        .Should()
        .HaveCount(1)
        .And.Contain(expectedAction);
    }
Beispiel #3
0
    public void As([Values(null, "tag")] object?tag)
    {
        var expectedType = typeof(List <>);
        var expected     = new RedirectOpenGenericType(expectedType, tag);

        // --arrange
        var actual = new Util.TestBuildChainPattern();
        var target = new TreatingOpenGenericTuner(actual);

        // --act
        target.As(expectedType, tag);

        // --assert
        actual.BuildActions.Should()
        .HaveCount(1)
        .And.ContainKey(BuildStage.Create)
        .And.Subject.Values.Single()
        .Should()
        .HaveCount(1)
        .And.Contain(expected);
    }