1,047 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
1
answer
96
views
Visual Studio Code C# Test Explorer: configuration of Run and Debug mode in dev container?
In a C# project within VSCode with xUnit tests, Test Explorer in the dev container offers you a Run and a Debug option. Where do you configure the details of these, or at least find a full description ...
0
votes
0
answers
111
views
xUnit Testing in Testing Explorer
I'm trying to add tests to my MAUI app.
I added the xUnit test project to a separate namespace. The tests only run in the terminal with the dotnet test command.
If I use the test explorer, it doesn't ...
2
votes
2
answers
106
views
How to disable binary log generation using Microsoft Testing Platform and xUnit v3?
I have the following project structure (the full repo can be found at https://github.com/asarkar/functional-csharp-buonanno) that uses Microsoft Testing Platform + xUnit v3 for testing.
root
├── src
│ ...
0
votes
0
answers
35
views
Ignore compiled files in .NET 9.0 code coverage report
I have an ASP.NET Core 9 Web API project and in the Azure DevOps pipeline, there are compiled files being collected for coverage - and there is no test code for those. For example the Mediator Library....
3
votes
1
answer
92
views
In xunit test catch block not executing after mocking
The code to be tested is as follows:
//pseudo code
public class ConnectionManager: IConnectionManager
(
ILogService _logService;
IConnector _iConnector;
public ConnectionManager(...
1
vote
1
answer
91
views
UnauthorizedAccessException not being caught in FakeItEasy test
I'm writing a unit test for a method that should catch UnauthorizedAccessException and return a special enum result. However, the test fails - the method returns Success instead of UnauthorizedAccess.
...
2
votes
1
answer
39
views
Passing parameters using reflection and passing method name as parameter [duplicate]
I have multiple lines which are mocking the method:
_mockClass.Setup(d => d.TestAsync(It.IsAny<string>(), It.IsAny<long>()))
.ReturnsAsync(1);
I want to make shorthand for the ...
0
votes
1
answer
103
views
Run DB setup once before ALL tests using multiple ICollectionFixture<WebApplicationFactory>?
I have multiple ICollectionFixture<WebApplicationFactory> and use the WebApplicationFactory::InitializeAsync to initialize the database. However, I run into duplicate PK issue.
I use xUnit with ...
0
votes
0
answers
69
views
ASP.Net Core 9 HttpClient.PostAsync fails to hit controller endpoint
HttpClient.PostAync does not reach controller endpoint at all. GetAsync and DeleteAsync are OK.
Program.cs:
builder.Services.AddControllersWithViews();
app.MapControllers();
Controller:
[Route("...
2
votes
1
answer
480
views
xUnit v3 filter not working with dotnet test
We want to upgrade to xUnit v3. All seems to go well locally, but on our build server we don't want to run all the tests.
The old action command-line is
dotnet test --filter "(FullyQualifiedName!~...
2
votes
0
answers
247
views
C#.NET xUnit v3 test with TestContainers and Respawn failing with timeout in Release mode but working in Debug
I'm encountering an issue with my integration tests that use TestContainers and Respawn. The tests work perfectly in Debug mode (and within seconds) but fail in Release mode with the following timeout ...
1
vote
1
answer
161
views
Why is my custom XUnit TraitAttribute not working
I am working within a multiproject repository and would like to specify project specific Unit tests. I have come across some resources which noted that it is possible to create a custom TraitAttribute....
2
votes
1
answer
580
views
Problems with unit test/integration .NET 8 project
I am having problems trying to do unit testing/integration with .NET 8 to a project (small api that works), I wanted to add tests to it to learn since I had never done them but I am running into ...
0
votes
0
answers
55
views
Is there a way to skip Xunit tests only in one derived class?
I'm using a template method for tests with an abstract base class.
The abstract class is just a template with code that will be used in each derived class, and when some part of the code differs, I ...
1
vote
2
answers
141
views
C# .Net 8.0 - Add .dll for tests xUnit
I have a ‘Project’ project in C# .Net 8.0 in which I use an external .dll library (a wrapper coded by ourselves that we'll call ‘wrapper.dll’).
I'm setting up a ‘Project.Tests’ test project with xUnit,...