Reporter | Martin (IAmMartin) |
---|---|
Created | Apr 23, 2018 4:28:38 PM |
Updated | Apr 23, 2018 4:28:47 PM |
Subsystem | No Subsystem |
Assignee | Unassigned |
Priority | Normal |
State | Submitted |
Type | Unspecified |
Fix version | No Fix versions |
Affected versions | 2018.1 |
Fixed In Version ReSharper | Undefined |
VsVersion | All Versions |
2018.1
Preview shows (incorrect
Actual (correct
namespace ReSharperBugs.v2018_1
{
[TestClass]
public sealed class ExtractMethodTests
{
[TestMethod]
public async Task Test()
{
// Extract this part of the method to a new method. START -->
IClient client = new Client();
Field[] fields = await client.GetAllFields(CancellationToken.None);
Dictionary<string, string> types = new Dictionary<string, string>();
foreach (Field field in fields)
{
types.Add(field.Id, "");
}
// <-- END
types.Count.ShouldBe(0);
}
}
public interface IClient
{
Task<Field[]> GetAllFields(CancellationToken ct);
}
internal class Client : IClient
{
public Task<Field[]> GetAllFields(CancellationToken ct)
{
throw new NotImplementedException();
}
}
public class Field
{
public string Id { get; set; }
}
}
Preview shows (incorrect
Task
)private static async Task Dictionary()
{
IClient client = new Client();
Field[] fields = await client.GetAllFields(CancellationToken.None);
Dictionary<string, string> types = new Dictionary<string, string>();
foreach (Field field in fields)
{
types.Add(field.Id, "");
}
return types;
}
Actual (correct
Task<Dictionary<string, string>>
)private static async Task<Dictionary<string, string>> Dictionary()
{
IClient client = new Client();
Field[] fields = await client.GetAllFields(CancellationToken.None);
Dictionary<string, string> types = new Dictionary<string, string>();
foreach (Field field in fields)
{
types.Add(field.Id, "");
}
return types;
}