Search
 
SCRIPT & CODE EXAMPLE
 

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);
Comment

PREVIOUS NEXT
Code Example
Csharp :: how to hide the title bar of window in monogame 
Csharp :: unity draw waypoins path 
Csharp :: c# Remove String In C# 
Csharp :: c# picturebox cursor hand 
Csharp :: Send Hotmail/Outlook Email C# (Win/ASP.NET) 
Csharp :: ontriggerenter2d 
Csharp :: exe path c# 
Csharp :: unity c# destroy gameobject 
Csharp :: c# create a dummy class 
Csharp :: how to make a character jump c# 
Csharp :: unity datetime to string 
Csharp :: demand a Security action c# 
Csharp :: install nuget package for S3 
Csharp :: How to install a windows service programmatically in C#? 
Csharp :: how to get length of okobjectresult c# 
Csharp :: C# How to display text in console 
Csharp :: how to edit .csproj file 
Csharp :: query parameters sending to controller action asp.net core 
Csharp :: DataGridView ComboBox column selection changed event 
Csharp :: C# random multiple of 5 in range 
Csharp :: unity normalize movement 
Csharp :: c# do while or 
Csharp :: c# int division to double 
Csharp :: how to return array in function c# 
Csharp :: how to set a color of text in unity 2020 script 
Csharp :: c# exception middleware 
Csharp :: loop in c# 
Csharp :: c# list initialize 
Csharp :: c# quick "is" "as" 
Csharp :: active form 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =