2011-01-05 88 views
3

我们在VS 2010中成功运行了一些Silverlight单元测试。 我正在使用Silverlight单元测试框架(http://silverlight.codeplex.com)。在TFS 2010中运行Silverlight单元测试版本

例如:

/// <summary> 
/// test the loading of the big org strucutre from the server 
/// this operation has a timeout attached. 
/// </summary> 
[TestMethod] 
[Asynchronous] 
[TimeoutAttribute(60100)] 
public void LoadOrgStructure() 
{ 
    _loadOrgStructureStart = getCurrentTicks(); 
    OrgStructureMemberDAC.Instance.GetOrganisationStructure(new EventHandler<GetOrganisationStructureOrgStructureMemberVOCompletedEventArgs>(delegate(object s, GetOrganisationStructureOrgStructureMemberVOCompletedEventArgs e) 
    { 
     //only run the following code in time 
     if (getElapsedMilliseconds(_loadOrgStructureStart) <= 60000) 
     { 
      if (e.Error != null) 
      { 
       //Clientside error 
       throw e.Error; 
      } 
      else if (e.Result.Error != null) 
      { 
       //Serverside error 
       throw new AssertFailedException(e.Result.Error.Message); 
      } 
      else 
      { 
       Assert.IsNotNull(e.Result.Result); // there must be root elements       
       Assert.IsTrue(e.Result.Result.Count > 0); 
       Assert.IsNotNull(e.Result.Result[0].ChildMemberLstObj); //there must be childs 
       Assert.IsTrue(e.Result.Result[0].ChildMemberLstObj.Count > 0); 
       EnqueueTestComplete(); 
      } 
     } 
    })); 
} 

当我在2010年VS运行该测试中,浏览器窗口中双头呆和测试成功运行。 现在我想用我的TFS-2010-Build运行这样的异步测试。但是我不知道如何通过构建来开始这个测试。这可能吗?

回答

相关问题