2010-05-26 23 views

Trả lời

7

Có nó là do thiết kế:

protected internal ViewResult View() 
{ 
    return this.View(null, null, null); 
} 

Thanh toán MVCContrib.TestHelper cho cú pháp tốt hơn:

// act 
var actual = controller.Index(); 

// assert 
actual.AssertViewRendered(); 
+0

Bạn có biết tên hiển thị của tôi từ đâu không? – Michel

+0

Từ tên của hành động đang được thực hiện. –

1

Hình như nó thực sự là:

protected internal ViewResult View() 
{ 
    return this.View(null, null, null); 
} 

protected internal virtual ViewResult View(string viewName, 
    string masterName, object model) 
{ 
    if (model != null) 
    { 
     base.ViewData.Model = model; 
    } 
    ViewResult result = new ViewResult(); 
    result.ViewName = viewName; 
    result.MasterName = masterName; 
    result.ViewData = base.ViewData; 
    result.TempData = base.TempData; 
    return result; 
} 
+0

Huh? thì nó sẽ lấy tên của tôi từ đâu? – Michel