You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public class TryCatch
{
public int Test()
{
#if TEST
var result = new Random();
return result.Next() + 1;
#else
var result = new Random();
return result.Next();
#endif
}
}
Expected:
public partial class TryCatch
{
public Task<int> TestAsync()
{
try
{
#if TEST
var result = new Random();
return Task.FromResult<int>(result.Next() + 1);
#else
var result = new Random();
return Task.FromResult<int>(result.Next());
#endif
}
catch (Exception ex)
{
return Task.FromException<int>(ex);
}
}
}
Actual:
public partial class TryCatch
{
public Task<int> TestAsync()
{
try
{
#if TEST
var result = new Random();
return result.Next() + 1;
#else
var result = new Random();
return Task.FromResult<int>(result.Next());
}
catch (Exception ex)
{
return Task.FromException<int>(ex);
}
#endif
}
}
The text was updated successfully, but these errors were encountered:
Example:
Expected:
Actual:
The text was updated successfully, but these errors were encountered: