Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

moq set delay to return

Mock<IFoo> mockFoo = new Mock<IFoo>();
mockFoo.Setup(f => f.Bar())
       .Callback(() => Thread.Sleep(1000))
       .Returns("test");

string result = mockFoo.Object.Bar(); // will take 1 second to return

Assert.AreEqual("test", result);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #moq #set #delay #return
ADD COMMENT
Topic
Name
1+2 =