Parsing function / method content using Reflection

前端 未结 3 497
一整个雨季
一整个雨季 2021-01-19 07:25

My unit testing frameworks consists of TestFixtures, TestMethods and Actions. Action is additional smaller container inside TestMethod, Actions comes from internal Dll writt

3条回答
  •  没有蜡笔的小新
    2021-01-19 08:18

    Instead of using reflection, why don't you roll out your own method that will log all Action executions.

    void ExecuteAction(Action action)
    {
       //Log TestFixture, TestMethod, Action
    
       //Execute actual action
    }
    
    [Test]
    void TestMethod1()
    {
        ExecuteAction(Run(new Sleep { Seconds = 10 } ));
    }
    

    ExecuteAction method can be in a base or helper class

提交回复
热议问题