Wie moq eine statische Klasse mit einer statischen Methode (UnitOfWork Fall)?

Habe ich diese Klassen:

public static class UnitOfWorkSS 
{
  public static IUnitOfWork Begin()
  {
    return IoC.Resolve<IUnitOfWork>();
  }
}

public class PostService
{
  using (IUnitOfWork unitOfWork = UnitOfWorkSS.Begin())
  {
    //don't forget to sanitize html content
    htmlContent = _htmlSanitizer.Sanitize(htmlContent);

    IPost post = _factory.CreatePost(byUser, title, htmlContent);                    

    _postRepository.Add(post);

    unitOfWork.Commit();
  }
}

Wie kann ich verspotte die Klassen UnitOfWorkSS und unitOfWork?

InformationsquelleAutor der Frage Attilah | 2010-11-26

Schreibe einen Kommentar