async/await
我有一个正在使用功能的 .NET 4.5 项目。
当我尝试在等待语句之后检查/快速观察变量引用时,我得到以下信息:
The name 'id' does not exist in the current context
知道如何解决这个问题,以便我可以调试它?
编辑 - 这是代码
[Fact]
public async Task works_as_expected()
{
var repo = Config.Ioc.GetInstance<IAsyncRepository<Customer>>();
var work = Config.Ioc.GetInstance<IUnitOfWork>();
Customer c= new Customer()
{
FirstName = "__Micah",
LastName = "__Smith_test",
DateCreated = DateTime.Now,
DateModified = DateTime.Now,
Email = "m@m.com",
Phone = "7245551212"
};
var id=await repo.Insert(c);
// i can't inspect the value of id
Assert.True(id > 0);
}