nunit

Is there a tool to merge NUnit result files?

纵饮孤独 提交于 2019-12-22 01:49:18
问题 For unclear reasons my Nunit test fixture cannot be executed in a single run, so I'm forced to execute a few tests in separate runs. However this means that the test results are splitted over multiple output files. Is there a tool available which can merge NUnit result XML files into a single XML file? I've tried using the existing Nunit-summary tool, but this simply sequentially parses the XML files with the given XSL file and concatenates the result as one big file. Instead I would like it

NUnit: Dictionary Assert

亡梦爱人 提交于 2019-12-22 01:25:49
问题 I want a one liner , in NUnit, that asserts whether two dictionary are the same. i.e., I want a concise version of the below code: public static void DictionaryAssert<T, U>(Dictionary<T, U> dictionaryResult, Dictionary<T, U> expectedResult) { Assert.AreEqual(dictionaryResult.Count, expectedResult.Count); foreach (var aKey in expectedResult.Keys) { Assert.AreEqual(expectedResult[aKey], dictionaryResult[aKey]); } } Surely it isn't so difficult, but I can't find the reference, any idea? 回答1:

Private Accessor don't build when using MSBuild

℡╲_俬逩灬. 提交于 2019-12-21 17:28:48
问题 My build server uses MSBuild to build my application. Our unit tests require access to some private members for testing, so we use the built in private accessors. Visual Studio has no problem with it, but when we push our code to the build server we get the error: MyTest.cs (96,13): errorCS0246: The type or namespace name 'My_Accessor' could not be found (are you missing a using directive or an assembly reference?) Why is it that MSBuild ignores the private accessors and how can I fix it? We

Nunit parameterised TestFixtures with parameters set at runtime?

大兔子大兔子 提交于 2019-12-21 17:25:05
问题 I'm interested in being able to instantiate multiple testfixtures with constructor arguments passed to it at runtime by a static method or property returning an IEnumerable. In Nunit 2.5 they introduced parameterised tests and test fixtures. These allow you to write a single test and run it with several inputs provided using the TestCase attribute, and write a single test class and instantiate multiple instances of it with different constructor arguments respectively. In addition to this, it

Installing nUnit with ASP.Net MVC 1.0

北城余情 提交于 2019-12-21 15:39:25
问题 Does anyone have any advice/information on how to install nUnit with ASP.Net MVC? I have seen previous posts which related to the preview releases and involved a ghoulish nightmare of having to create template files, run command prompt and even mess with the registry. Obviously this is far from ideal and given Microsoft's intention to allow any testing framework I was hoping that it was a much improved process in the full release. Googling seems to return results from when MVC was in the

Nunit-agent debug workaround

允我心安 提交于 2019-12-21 13:06:05
问题 I attached to nunit-agent.exe about 49 times today, and my fingers are getting tired. I was wondering if there is an automated way to get the nunit-agent.exe attach to the debugger within Visual Studio 2010? 回答1: I changed my nunit.exe.config file based on the instructions on this page. Worked like a charm. 来源: https://stackoverflow.com/questions/3586713/nunit-agent-debug-workaround

Unit Testing: Self-contained tests vs code duplication (DRY)

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-21 12:31:04
问题 I'm making my first steps with unit testing and am unsure about two paradigms which seem to contradict themselves on unit tests, which is: Every single unit test should be self-contained and not depend on others. Don't repeat yourself. To be more concrete, I've got an importer which I want to test. The Importer has a "Import" function, taking raw data (e.g. out of a CSV) and returning an object of a certain kind which also will be stored into a database through ORM (LinqToSQL in this case).

Can I configure NUnit so that Debug.Fail doesn't show a message box when I run my tests?

夙愿已清 提交于 2019-12-21 11:39:11
问题 I have this property: public SubjectStatus Status { get { return status; } set { if (Enum.IsDefined(typeof(SubjectStatus), value)) { status = value; } else { Debug.Fail("Error setting Subject.Status", "There is no SubjectStatus enum constant defined for that value."); return; } } } and this unit test [Test] public void StatusProperty_StatusAssignedValueWithoutEnumDefinition_StatusUnchanged() { Subject subject = new TestSubjectImp("1"); // assigned by casting from an int to a defined value

Does NUnit support the concept of an Assembly Teardown?

久未见 提交于 2019-12-21 10:52:04
问题 Does NUnit support the concept of an Assembly Teardown similar to the Microsoft.VisualStudio.TestTools.UnitTesting.AssemblyCleanupAttribute that can be applied to a static method? This would be run after all the tests within the assembly have completed. I am currently using NUnit 2.6.0. 回答1: It turns out this functionality does exist in NUnit it is just not very obvious or intuitive. According to Charlie Poole in the feature request I made for this functionality here, he states the following

Delayed NUnit Assert message evaluation

青春壹個敷衍的年華 提交于 2019-12-21 08:08:25
问题 I have this assert in my test code Assert.That(() => eventData.Count == 0, Is.True.After(notificationPollingDelay), "Received unexpected event with last event data" + eventData.Last().Description()); that asserts some condition after a period of time and on failure produces a message. it fails to run because the message string is constructed when the assert starts and not when the assert ends. therefore the eventData collection is still empty (as it is initially) and the attempt to get the