nunit

XSD for the XML file that Nunit uses

左心房为你撑大大i 提交于 2019-12-23 16:07:04
问题 Where can I find the XSD for the XML file that Nunit uses ? 回答1: For the results file? See Results.xsd (note that it didn't display properly for me, in Chrome; you may have to view source, or download, to see it properly). A transform file, and a sample results file, are in the parent directory. The files are also in the documentation package on the NUnit download page. 来源: https://stackoverflow.com/questions/3878018/xsd-for-the-xml-file-that-nunit-uses

What makes a good failure message for testunit or other nunit style frameworks?

倾然丶 夕夏残阳落幕 提交于 2019-12-23 13:16:12
问题 In Ruby's test/unit, and other such nunit style frameworks, what makes a good failure message? Should the failure message merely describe how the expected value does not match the expected value? assert_match("hey", "hey this is a test", "The word does not exist in the string") Should it describe what you expected to happen? assert_match("hey", "hey this is a test", "I expected hey to be in the string") Should it describe why you wanted the behavior to happen? assert_match("hey", "hey this is

NUnit Unit Test has “ExpectedException” but still failing on exception

落花浮王杯 提交于 2019-12-23 12:54:38
问题 I have a unit test that is failing because a System.ArgumentException is being thrown, even though I am expecting it and it's deliberate behaviour - what have I missed? [Test] [ExpectedException(typeof(ArgumentException), ExpectedMessage = "Seconds from midnight cannot be more than 86400 in 010100712386401000000012")] public void TestParsingCustomReferenceWithInValidSecondsFromMidnight() { // I am expecting this method to throw an ArgumentException: CustomReference.Parse(

How to do exception handling with nunit and moq?

此生再无相见时 提交于 2019-12-23 11:55:18
问题 I am trying to use nunits new way of exception handling but I am finding it hard to find information on it and how to also use it with moq. I have right now moq that throws a exception on a mocked method but I don't know how to use nunit to catch it and look at it. 回答1: There's a few different ways to do it; I use Assert.Throws. var exception = Assert.Throws<YourTypeOfException>(()=> Action goes here); e.g. var exception = Assert .Throws<ArgumentNullException>(()=> new ChimpPuncher(null));

log4net Configuration Section for NUnit Test Project

与世无争的帅哥 提交于 2019-12-23 11:48:05
问题 I am running NUnit with the project named AssemblyTest.nunit. The test calls another assembly which uses the log4net assembly. This is using nunit version 2.4.3 with the .net 2.0 framework. In TestFixtureSetup I am calling log4net.Config.XmlConfigurator.Configure( ) and am getting the following error: System.Configuration.ConfigurationErrorsException: Configuration system failed to initialize ---> System.Configuration.ConfigurationErrorsException: Unrecognized configuration section log4net.

MSBuild targets to run all tests, even if some fail

廉价感情. 提交于 2019-12-23 11:47:48
问题 I have an MSBuild script that runs NUnit unit tests, using the console runner. There are multiple tests projects and I'd like to keep them as separate MSBuild targets, if possible. If the tests fail I want to overall build to fail. However, I want to continue running all the tests, even if some of them fail. If I set ContinueOnError="true" then the build succeeds regardless of test outcomes. If I leave it at false then the build stops after the first test project that fails. 回答1: One way to

MSBuild targets to run all tests, even if some fail

无人久伴 提交于 2019-12-23 11:47:03
问题 I have an MSBuild script that runs NUnit unit tests, using the console runner. There are multiple tests projects and I'd like to keep them as separate MSBuild targets, if possible. If the tests fail I want to overall build to fail. However, I want to continue running all the tests, even if some of them fail. If I set ContinueOnError="true" then the build succeeds regardless of test outcomes. If I leave it at false then the build stops after the first test project that fails. 回答1: One way to

How to properly unit test calling UI method on another thread?

感情迁移 提交于 2019-12-23 10:57:10
问题 Having coded an extension method (based on GUI update when starting event handler class on separate thread?): public static class ControlExtensions { public static TResult InvokeEx<TControl, TResult> (this TControl control, Func<TControl, TResult> func) where TControl : Control { if (control.InvokeRequired) return (TResult)control.Invoke (func, control); return func (control); } } I've been trying to unit test this method both from a UI thread and a normal thread and I can't seem to be able

How to run UWP NUnit tests in with Visual Studio 2015?

可紊 提交于 2019-12-23 10:57:09
问题 This question is specifically about running Universal Windows Platform (UWP) unit tests written in C# for NUnit. How can I discover and run these tests in Visual Studio? I could find no definitive articles on this on the web, which is really surprising. 回答1: I happened upon this asking if xUnit was still the only way to write tests. NUnit Wiki for Xamerin / UWP My current setup is Visual Studio 2015 Community Nunit Test Adapter (3.2.0) Nunit 3 Templates (1.2) I added a new project in the

Visual Studio 2013 feature Code Lens with NUnit

走远了吗. 提交于 2019-12-23 09:39:10
问题 In the new Visual Studio 2013 there is a nice new feature called Code Lens (I think that it is only in the Ultimate version). Regarding methods, besides it shows references (how many and where) it also shows some information about versioning when working in team and tests statistics so that you know how many tests using the method are passing and how many failing. I assume that this works perfectly with test projects embedded in Visual Studio, but does it work with NUnit? We are using NUnit