????????????????????????????????????????????ú????????????????磺??????????????????????Log?? ????? ??????? ???????????????Щ???????????  ??????????????????????Stub??Mock???????Щ??????????????????????
?????????
???????
??????????????
??????????????
????Stub??Mock???????
????Stub??Mock??????
????????????????????????
????Mock???
?????????????
???????
????Analyze?????filename?????????С??8????????????????IWebService?????????????.
?????????????Analyze????д????????

 

public class LogAnalyzer
{
private IWebService service;
private IEmailService email;
public IWebService Service
{
get { return service; }
set { service = value; }
}
public IEmailService Email
{
get { return email; }
set { email = value; }
}
public void Analyze(string fileName)
{
if (fileName.Length < 8)
{
try
{
service.LogError("the file name is to short" + fileName);
}
catch (Exception e)
{
email.SendEmail("From@test.com"?? "To@test.com"?? "IWebServiceFailed"?? e.Message);
}
}
}
}