小编Ale*_*lex的帖子

单元测试和PostSharp

我想知道最好的方法是什么...我有兴趣将PostSharp引入我的一个项目中,但我不确定如何正确地测试标记有属性的类.

例如:

public class hello {

    [MyAspectThatDoesSomethingToTheDatabaseWhenThisMethodGetsCalled]
    public int omg(string lol) {
        //fancy logic in here
    }
}
Run Code Online (Sandbox Code Playgroud)

我想测试omg()方法中的逻辑,但是在单元测试中我需要确保不会调用方面,因为实际上没有数据库.

思考?

aop nunit unit-testing postsharp

14
推荐指数
1
解决办法
1378
查看次数

标签 统计

aop ×1

nunit ×1

postsharp ×1

unit-testing ×1