7,550 questions
0
votes
1
answer
28
views
.NET elasticsearch testcontainer tests fail in run mode, but succeed in debug mode
I use NUnit and Testcontainers to test my custom method for fetching data from Elasticsearch. The code to interact with elasric is this
using ArticleStorage.Api.Models;
using ArticleStorage.Api.Models....
-3
votes
1
answer
50
views
Crystal Report generates reports correctly in parallel on IIS but throws System.Runtime.InteropServices.COMException in NUnit test
When running NUnit test to check if multiple PDF reports have been generated correctly the following exception is being thrown System.Runtime.InteropServices.COMException : Invalid index. (Exception ...
1
vote
4
answers
124
views
Unit test fails when running all tests, but not when run as a single test
One unit test keeps failing when I run all unit tests, but doesn't fail when running it as a single test. I've marked it with a comment below. When firing the RulesEngine via Session.Fire() there is ...
1
vote
1
answer
34
views
Clean folder in Azure Windows agent
I have a yaml script which runs in Azure Windows agent. At the end of my job, I need to delete inside of this created folder:
C:\agent\_work\1\s
This folder keeps my test project.
How can I delete it ...
0
votes
0
answers
41
views
How to Moq GraphServiceClient's DeleteAsync()
I have the test below which fails when using MockBehavior.Strict. The _requestAdaptor shown is used in over 200 other tests and works as expected.
[Test]
public async Task ...
1
vote
1
answer
64
views
How to adjust the Request Timeout for CreateContainerIfNotExistsAsync when using the Cosmos DB Emulator via Testcontainers.CosmosDb?
In my C# NUnit testing project, I use the Testcontainers.CosmosDb NuGet package to create a CosmosDbConnector using their CosmosDbBuilder.
using NUnit;
using Microsoft.Azure.Cosmos;
using ...
0
votes
0
answers
48
views
How to make sure that resources are not shared in dotnet unit tests and the tests run sequentially? [duplicate]
using System.Net;
using System.Text.Json;
using Microsoft.Extensions.Logging;
using Moq;
using Moq.Protected;
using NUnit.Framework;
namespace pg_sdk_dotnet.tests;
public class GlobalSetup{
...
0
votes
1
answer
33
views
How can I test my Linux Containerized ASP.NET Core app using NUnit in Visual Studio?
I have an ASP.NET core app that runs in Docker on Linux containers and I need to write unit tests for it.
I cannot compile and run the tests on Windows because the app requires a DLL compiled from C++ ...
0
votes
1
answer
40
views
How to test(make sure it comes under Sonar coverage) Catch blocks?
I am new to NUnit(3.4+) and somehow not able to solve the below simple issue :)
I want to make sure the catch blocks are covered in Sonar coverage and for that want to write a Nunit test case. I have ...
0
votes
2
answers
42
views
Can setup methods run in parallel for NonParallelizable tests?
I have a test method with a NonParallelizable attribute. The question is:
Can it be, that TestSetup() method runs in parallel to the running TestMeth() of previous test case and only TestMeth() ...
0
votes
1
answer
37
views
Unable to find ITestEventListener when running NUnit tests [closed]
I'm trying to load an NUnit engine extension when running dotnet test, but the engine is failing to find and load the extension - no txt file is created during the test execution. I've followed the ...
0
votes
0
answers
40
views
Testing interaction between two web services
I'm learning integration tests on very simple example.
Specs:
I have 2 .Net Core apps: App1 and App2.
App1 uri: "http://localhost:1111",
App2 uri: "http://localhost:2222"
Scenario:
...
0
votes
1
answer
23
views
Returning different values with multiple calls to a method in MOQ
I'm working on a unit test for a controller that calls a handler to retrieve a list of consumers multiple times.
The handler calls GetItemsAsync() and returns either a null value or a list of ...
0
votes
0
answers
57
views
How to write a Unit Test for Post operation using Moq and NUnit
I'm trying to create a Unit Test for CRUD operations for my ASP.NET Core Web API project. I have a hard time figuring out how to do that for POST.
This is my service;
public async Task ...
0
votes
1
answer
34
views
Add a global [OneTimeSetUp]/[OneTimeTearDown] for tests spanning multiple projects
I'm using rider and running integration tests across multiple projects which all run in parallel.
Prior to running my tests, I need to clear down all data in my database.
The reason I'm not adding a [...