xunit Questions

1

How can I exclude a method from code coverage reporting using coverlet and reportgenerator. Excluding entire namespaces in .runsettings works as expected but using [ExcludeFromCodeCoverage] attribu...
Urbanism asked 3/6, 2020 at 1:5

1

Solved

I've been creating integration tests using Xunit for a .NET Core 3.1 web app that uses a database. For testing I've swapped to an in-memory database following along from the Microsoft Documentation...
Mcginty asked 27/5, 2020 at 16:39

3

Solved

I'm creating a very simple test project to experiment with various Azure DevOps CI/DI features. This project contains a solution with an ASP.NET Core website project, and an xUnit unit tests projec...
Reina asked 25/2, 2019 at 15:20

4

Solved

I am new in XUnit tests for Web API application. I am trying to make assertion of my response value with the status code 404, but I am not sure how to do so. Here's my test code. Assume the in...
Flotsam asked 19/4, 2018 at 6:31

2

Solved

I have a unit test where I try to verify that I have disposed of a document that was once attached to the main user interface. The unit test has to be async in that everything needs to be run under...
Concha asked 5/12, 2016 at 6:52

1

Solved

I'm having some troubles with my azure devops testing-pipeline. I'm using xunit tests and every test-project runs correctly and I can view the test results, but the pipeline fails anyway because of...
Ariana asked 29/5, 2020 at 16:52

3

public class test2InAnotherProject { private readonly ITestOutputHelper output; public test2InAnotherProject(ITestOutputHelper output) { this.output = output; } int Diff(int a, int b) { re...
Raynor asked 20/3, 2019 at 10:7

3

Solved

I'm trying to add integration testing to my project but I keep getting the error "The type or namespace name 'Startup' cound not be found" in my Tests.cs file. I have two project.json files, one i...
Elephantiasis asked 29/11, 2016 at 1:27

1

Solved

Some mistake in a code test rise this question, due the extension of the code, here is a complete project that replicates exactly the problem we have (to save you analyzing tons of lines). The issu...
Idiomatic asked 26/5, 2020 at 23:46

1

When trying to run a very basic xunit test in debugging mode my test project throws several exceptions which seems to come from ReSharper. Exception thrown: 'System.IO.FileNotFoundException' in m...
Doge asked 11/9, 2018 at 8:47

1

We have several environments that had their own run settings when we used MSTest. Since Microsoft is abandoning MSTest we are switching to xUnit. Whether it's through a runsettings or a command lin...
Bootee asked 19/7, 2016 at 12:43

4

Solved

Is it possible to use xUnit with LINQPad? It would be great to be able to write some tests for concepts being designed in LINQPad first. It's easier than adding yet another ConsoleApp23423894238 j...
Outwards asked 14/10, 2018 at 0:21

4

Solved

I realize there have been a LOT of questions on this topic but somehow I haven't found one that addressed my needs. My team is looking to start automated Unit testing our application. We have neve...
Flange asked 27/6, 2016 at 21:59

1

Solved

I'm using the excellent Shouldly library in my xUnit tests and I'm finding myself using the set sequence of assertions in different tests, so I'm combining them into new assertion extension methods...
Mundane asked 6/5, 2020 at 2:22

1

Solved

I am having an issue when trying to unit test signalr components using Mock. Here is where the issue occurs _logger.LogInformation($"Registering a Station with id: {Id}" + $" with status: {Stat...
Hoarding asked 27/4, 2020 at 16:34

2

Solved

I'm looking to test an ActionFilterAttribute in a .NET Core 2.0 API project and wondering the best way to go about it. Note, I'm not trying to test this through a controller action, merely test the...
Fescennine asked 11/9, 2017 at 19:17

2

Solved

I have a net472 project containing unit tests using xUnit, which I develop in VS 2017. The project contains tests for an ASP.NET Core project. I have migrated its packages.config to the PackageRef...
Hairdo asked 6/2, 2019 at 14:5

1

Solved

I defined simple event in class like that class Request { protected virtual void OnStateChanged() { StateChanged?.Invoke(this, EventArgs.Empty); } public event EventHandler StateChanged; ...
Whirlpool asked 29/3, 2020 at 17:18

4

Solved

I have a test fixture in which I initialize my SQLite in-memory dbcontext, shown below: public static MYAPPDBContext Create() { var options = new DbContextOptionsBuilder<MYAPPDBContext>() ...
Blamed asked 30/10, 2019 at 15:34

2

I am writing a simple unit test for this small service that simply calls external APIs: public class ApiCaller : IApiCaller { private readonly IHttpClientFactory _httpFactory; public ApiCaller(...
Thies asked 9/5, 2019 at 16:42

0

"An object reference is required for the non-static field" I have a static member which cannot be an instance member. This static member uses an instance of an object that is initialized in the con...
Goaltender asked 9/3, 2020 at 17:13

1

Solved

I was doing unit test using xUnit package for my class library. I would like to try on JSON approach rather than normal object approach for data-driven unit test. However I don't see anywhere that ...
Acanthous asked 1/3, 2020 at 8:37

3

Solved

I'm creating ASP.NET Core integration tests (xUnit based) following these docs. I want to start the test web server with its own appsettings.json. My abbreviated folder structure is: \SampleAspNet...
Yearround asked 10/12, 2018 at 11:9

2

Solved

I want to publish xunit test results in an Azure Devops release pipeline using the "Publish test results" task Version 1.* and 2.*. Although xunit test file is present and has content - I checked ...
Dailey asked 13/2, 2020 at 8:44

1

Solved

I am writing a test suite for a class library using C# and XUnit. In the library are a number of classes that implement an interface. I could simply copy-paste the same tests for the interface impl...
Acidulent asked 14/2, 2020 at 0:55

© 2022 - 2024 — McMap. All rights reserved.