nunit Questions

10

Solved

I'm just starting with TDD and could solve most of the problems I've faced on my own. But now I'm lost: How can I check if events are fired? I was looking for something like Assert.Raise or Assert....
Tetralogy asked 2/8, 2010 at 11:9

5

Solved

I have a project that has a [TestFixture, Category("Oracle")] and a [TestFixture, Category("OracleOdbc")] with a couple of tests which I would like to execute separately using dotnet test. H...
Suave asked 10/1, 2018 at 20:51

10

Solved

In a test that contains some asserts, for example: Assert.AreEqual(1,1); Assert.AreEqual(2,1); Assert.AreEqual(2,2); is it possible to let the test keep running after it fails at some point? In ...
Predecessor asked 14/5, 2010 at 14:6

3

Solved

Want to write unit test for HttpTrigger GET. Have method signature as follow: public static async Task<HttpResponseMessage> Run( [HttpTrigger(AuthorizationLevel.Function, "get", Route = nul...

4

I have an issue where NUnit is telling me: "No suitable constructor was found". What causes this? I also get another message: "Exception doesn't have a stacktrace". Both messages just repeat over a...
Civilized asked 19/4, 2016 at 15:0

14

Solved

I recently converted from MSTest to NUnit. I did this by replacing all occurrences of [TestMethod] by [Test], [TestClass] by [Test], etc. I also deleted the Microsoft.VisualStudio... reference a...
Kobarid asked 14/11, 2011 at 3:11

11

Solved

Good day everyone. I have been having the same problem all day at work and am struggling to find any new paths to go down. I am getting the following error when my solution builds on server. I ha...
Descender asked 26/3, 2012 at 15:36

4

I've installed NUnit (4.0.1) and NUnit3Testadapter (4.5.0) as a NuGet Package in Visual Studio 22. Wrote my test cases, but I'm getting errors that definitions are missing from the Assert class: E...
Sharpeyed asked 8/1, 2024 at 14:43

4

Solved

i am using Nunit and Autofac's Moq to setup a test [TestFixture] public class SomeTests { [OneTimeSetUp] public void Initialize() { } [Test] public void SalaryCheck() { using (var mock...
Firm asked 21/7, 2016 at 14:33

11

Solved

I need to test the following method: CreateOutput(IWriter writer) { writer.Write(type); writer.Write(id); writer.Write(sender); // many more Write()s... } I've created a Moq'd IWriter and I...
Kropp asked 15/5, 2012 at 13:53

5

Solved

I'm aware that there is a Timeout attribute in NUnit. My problem is that the unit tests actually spawn a new process which, if frozen, is never killed by NUnit. How can I implement a timeout which ...
Pentateuch asked 5/1, 2011 at 15:3

2

Is there a way of programatically getting the selected test categories while executing a test? something in the lines of TestContext.Properties["_SELECTCATEGORIES"] basically i've got test cases w...
Solange asked 13/6, 2012 at 15:4

3

I'm currently writing an integration test (https://learn.microsoft.com/en-us/aspnet/core/test/integration-tests?view=aspnetcore-5.0) for my ASP .Net Core 5 REST API. The API is using Serilog for lo...
Phototube asked 21/12, 2020 at 9:32

4

I am encountering the error during the Build phase of an Azure Pipeline on the Azure DeveOps site. Specifically, the packages it is complaining about are: 2018-09-30T20:35:07.6022998Z ============...

23

Solved

I have a unit test (nUnit). Many layers down the call stack a method will fail if it is running via a unit test. Ideally you would use something like mocking to setup the object that this method i...
Chlori asked 2/7, 2010 at 16:52

3

I would like to run unit tests from .NET TEST EXPLORER, not the command line. I can run tests when navigating to the unit test directory and executing dotnet test. But selecting .NET TEST EXPLORER...
Washwoman asked 16/1, 2019 at 1:6

3

Solved

To be succint: class AutoMoqDataAttribute : AutoDataAttribute { public AutoMoqDataAttribute() : base(new Fixture().Customize(new AutoMoqCustomization())) { } } public interface IWeapon { bool ...
Arv asked 17/7, 2014 at 7:45

5

Solved

I have a webappliction with a separate test-project using NUnit to run unittests. When my test-project is trying to discover tests I run into the following exception: An exception occurred while t...
Deryl asked 30/1, 2018 at 16:26

11

Solved

NUnit has a feature called Values, like below: [Test] public void MyTest( [Values(1,2,3)] int x, [Values("A","B")] string s) { // ... } This means that the test method will ...
Abstruse asked 26/1, 2012 at 16:50

3

Solved

I'm running unit tests in ReSharper with NUnit 3.10. I'm getting this error when doing a simple async test: Method has non-void return value, but no result is expected My test is literally: [Test...
Amnesty asked 5/8, 2021 at 12:44

3

Solved

I'm trying to write a unit test for a greater than overridden operator using Fluent Assertions in C#. The greater than operator in this class is supposed to throw an exception if either of the obje...
Mariande asked 26/1, 2016 at 3:10

5

Solved

I am writing a data-intensive application. I have the following tests. They work, but they're pretty redundant. [Test] public void DoSanityCheck_WithCountEqualsZeroAndHouseGrossIsGreater_InMerchant...
Querulous asked 19/11, 2010 at 0:0

2

Solved

I have a TestFixture marked class which is Unit testing the functionality of a class named 'HideCurrentTitleBarMessageTask'. In this class I use a substitute to mock an interface in the [Setup] me...
Armlet asked 11/4, 2017 at 15:8

5

Solved

I'm developing some end-to-end tests using C# with .NET Core, Selenium and NUnit. Now i want to write a login testcase. My tests are started from console simply by using the dotnet test command. I...
Dermatology asked 6/1, 2019 at 17:30

10

Solved

I'm running NUnit tests to evaluate some known test data and calculated results. The numbers are floating point doubles so I don't expect them to be exactly equal, but I'm not sure how to treat the...
Benzidine asked 24/1, 2011 at 21:2

© 2022 - 2025 — McMap. All rights reserved.