Advertisement
Guest User

Untitled

a guest
Jul 25th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. public class MyClass {
  2. private readonly static MyClass _instance = new MyClass();
  3. public MyClass Instance { get { return this._instance; }}
  4.  
  5. private MyClass()
  6. {
  7. DoSomething();
  8. }
  9. }
  10.  
  11. [TestMethod]
  12. public void TestMethod1()
  13. {
  14. var fakeSingleton = Isolate.Fake.AllInstances<MyClass>();
  15.  
  16. Isolate.WhenCalled(() => fakeSingleton.someFunction()).WillReturn(true);
  17.  
  18. Assert.IsTrue(MyClass.Instance.someFunction());
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement