Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
0 votes
1 answer
24 views

.NET Integration Test Singleton Service instantiated twice

I am working on a .NET SQL Server based application for which I need to write Integration tests. I am using CustomWebApplicationFactory to overide DbContextFactory to use an in-memory SQLite DB in ...
ankushbbbr's user avatar
4 votes
1 answer
150 views
+50

How to perform integration test on ASP.NET Core API controller endpoint that requires authentication and validation of antiforgery tokens

Description I have an ASP.NET Core API controller endpoint that requires: an authenticated user, and validation of antiforgery tokens I want to perform an integration test on this endpoint. Problem ...
zwoolli's user avatar
  • 159
1 vote
0 answers
34 views

Random test failures in kafka integration tests with TestContainer

I'm experiencing inconsistent failures in my Kafka integration tests using TestContainers. The tests involve simple produce and consume operations along with database seeding, but sometimes they pass ...
Sandro Revazishvili's user avatar
-1 votes
0 answers
22 views

Change PhysicalFilesWatcher polling interval

The PhysicalFilesWatcher, which is being used when setting the UsePollingFileWatcher = true in PhysicalFileProvider, has a default polling interval of 4 seconds. Is it possible to change this interval?...
Alexander Zeitler's user avatar
0 votes
0 answers
18 views

Do I need to create a custom authentication handler for my integration tests in .NET if I use KeyCloak in my application?

I'm currently working on a .NET application that uses Keycloak for authentication. For my integration tests, I want to avoid actually connecting to the Keycloak server to keep the tests fast and ...
Hasan Kanaan's user avatar
0 votes
0 answers
22 views

Integration Tests with Custom Authentication in ASP.NET Core Returning 401 Unauthorized

Description: I'm setting up integration tests for an ASP.NET Core application using the minimal hosting model in .NET 6. I am trying to mock the authentication process using a custom authentication ...
Hasan Kanaan's user avatar
0 votes
0 answers
27 views

Could not load dependency but integration test can

I have an application which has depends on 2 custom build nugets. Lets call hem DepA (version 1.6.0) and DepB (version 1.2.5) for now. Both DepA and DepB depend on DepP but on different versions: ...
Maarten Kieft's user avatar
0 votes
0 answers
58 views

Calling an API to test in .NET Core with webhost factory http client throws 404 error

Description: I'm working on setting up integration tests for my ASP.NET Core application using WebHostFactory. I've configured a test server with custom authentication and an in-memory database, but ...
Hasan Kanaan's user avatar
1 vote
1 answer
44 views

Does anyone know why the C#/.NET DI Container thinks my dependency is Scoped when declared as a singleton?

I'm currently implementing a new feature, but when I try to run the integration tests for the project, the DI container throws an exception. It thinks the dependency I'm calling from my ...
kwerie's user avatar
  • 21
0 votes
1 answer
54 views

Prevent WebApplicationFactory from passing any arguments to the Program.Main method

I have an ASP.Net application where the Program.Main method is doing this: public class Program { public static async Task Main(string[] args) { var parserResult = CommandLine.Parser....
OBones's user avatar
  • 320
1 vote
0 answers
29 views

WebApplicationFactory failing to replace registrations in Background Service

I have run into an issue when trying to integration test a background service that listens to messages from RabbitMq. The issue is, after the first test runs, the subsequent test still has the same ...
CountZero's user avatar
  • 6,319
0 votes
1 answer
57 views

C# data within in-memory database persists in different test runs

I'm writing an integration test for my API. I've decided to go for an in-memory database however, I'm having some issues. When I first ran the test, everything ran smoothly and I was returned a 200Ok ...
Farhad 95's user avatar
0 votes
0 answers
65 views

Why does my C# API integration test only run in Release mode and not in Debug mode?

I have a C# test project with an API integration test that only runs successfully when the Configuration Manager is set to "Release" and I execute the test in Release mode. The test fails to ...
GrinGenius's user avatar
0 votes
2 answers
163 views

How can I change the connection string that WebApplicationFactory during integration testing?

I am integration testing a .NET API that connects to MongoDB using the connection string and database name values stored in an app.settings.json file. I am using xUnit and Test Containers to carry out ...
noepse's user avatar
  • 1
0 votes
0 answers
68 views

Want to mock MongoDB.Driver in appropriate manner to store data in memory considering FilterDefinition and UpdateDefinition

I am writing integration test and want to mock MongoDB.Driver in appropriate manner to store data in memory considering FilterDefinition and UpdateDefinition so all the operations can be performed ...
Ved Singhal's user avatar

15 30 50 per page
1
2 3 4 5
51