0
我需要幫助,我很新的痣,我有以下代碼:痣:使密封可見的內部類
namespace A.BusinessLayer
{
sealed class AManager
{
void Method1(object obj){
// do something
}
}
public class B
{
void Method1(object obj){
if some thing{
AManager a=new AManager();
a.Method1();
}
}
}
}
現在,我創建了上述類別如下單元測試(不知道這是否可能): 說明:當B.Method1被調用時,我只是不想檢查A.Method1是否從實現中調用,這就是我期望的代碼測試。
namespace A.Tests
{
class BTest
{
void Method1Test(){
//I need something like
A.BusinessLayer.Moles.MAManager t=new A.BusinessLayer.Moles.MAManager();
t.Method1=(obj)=>{
Assert.IsTrue(true);
};
B=new B();
B.Method1();
//Assert.IsTrue(true);
}
}
}
我加入下列屬性集信息類A.BusinessLayer項目爲:
[assembly: InternalsVisibleTo("A.BusinessLayer.Moles")]
[assembly: InternalsVisibleTo("A.BusinessLayer.Tests")]
問題是我看不到任何痣的AManger類?
任何幫助,甚至改善我的方法將appriciated。
更新:我看到* moles.xml文件類AManager,但不能看到它的A.BusinessLayer.Moles通過對象瀏覽器中