示例#1
0
    public void treat_inheritors_generic([Values(null, "tag")] string tag)
    {
        var expected = new SkipWhileUnit(new IsInheritorOf(typeof(IDisposable), tag));

        // --arrange
        var tree   = new BuildChainPatternTree();
        var target = new RootTuner(tree);

        // --act
        // --assert
        target.TreatInheritorsOf <IDisposable>(tag);
        tree.Children.Single().Should().BeEquivalentTo(expected);
    }
示例#2
0
    public void treat_all([Values(null, "tag")] string tag)
    {
        var expected = new SkipAllUnits();

        // --arrange
        var tree   = new BuildChainPatternTree();
        var target = new RootTuner(tree);

        // --act
        target.TreatAll();

        // --assert
        tree.Children.Single().Should().BeEquivalentTo(expected);
    }
示例#3
0
    public void building_generic([Values(null, "tag")] string tag)
    {
        var expected = new SkipWhileUnit(new UnitPattern(typeof(IDisposable), tag));

        // --arrange
        var tree   = new BuildChainPatternTree();
        var target = new RootTuner(tree);

        // --act
        target.Building <IDisposable>(tag);

        // --assert
        tree.Children.Single().Should().BeEquivalentTo(expected);
    }
示例#4
0
    public void treat_open_generic([Values(null, "tag")] string tag)
    {
        var expected = new SkipWhileUnit(new IsGenericOfDefinition(typeof(List <>), tag));

        // --arrange
        var tree   = new BuildChainPatternTree();
        var target = new RootTuner(tree);

        // --act
        var tuner = target.TreatOpenGeneric(typeof(List <>), tag);

        // --assert
        tree.Children.Single().Should().BeEquivalentTo(expected);
        tuner.Should().BeOfType <TreatingOpenGenericTuner>();
    }
示例#5
0
    public void amend_weight([Values(null, "tag")] string tag)
    {
        const int weight = 3875;

        var expected = new SkipWhileUnit(new UnitPattern(typeof(IDisposable), tag), weight);

        // --arrange
        var tree   = new BuildChainPatternTree();
        var target = new RootTuner(tree);

        // --act
        target.Building <IDisposable>(tag)
        .AmendWeight(weight);

        // --assert
        tree.Children.Single().Should().BeEquivalentTo(expected);
    }