2014-07-14 123 views
1

在下面的代碼中,運行器中沒有找到測試,我不知道爲什麼。請解釋一下爲什麼?我的nunit測試不是從Visual Studio 2013運行中運行

[TestFixture] 
public class RepositoryTest 
{ 
    [SetUp] 
    public void Init() 
    { 
    } 

    [Test] 
    public void whenIAskForAllTheLocationsAllTheLocationsAreReturned() 
    { 
     var repo = new LocationRepository(); 
     var locations = repo.GetLocationsByName("%"); 
     Assert.AreEqual(locations.Count(), 8); 
     Assert.AreEqual(locations.First().LocationName, "Kipling Road"); 
    } 
} 
+0

除了安裝NUnit的測試適配器外,您還可以使用[resharper](http://www.jetbrains.com/resharper/features/unit_testing.html)自動檢測並運行MSTest和NUnit測試。 –

+0

@ Smith.h.Neil:你應該澄清,這不是一個免費的組件... –

回答

1

默認情況下,Visual Studio不會運行nunit測試,只有MSTests。爲了從Visual Studio本地運行nunit測試,請安裝NUnit Test Adapter。不知道它是否對快速版有效。