All Questions
169 questions
-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 ...
0
votes
2
answers
147
views
Create a unit test to verify data from a SQL view in a .NET EF Core project
We created an API, which will fetch data from a SQL view created in the database.
Here is the repository code:
List<Entities.MyView> reportsData = await (
from r in _context.MyView
where ...
0
votes
0
answers
282
views
Wrong Appsettings.json picked at build with Unit test project referencing another project with its own appsettings
With Visual Studio 2022 in C#, we are referencing from our Unit tests project another project which is a WebApplication.
The web application is tested using Microsoft's WebApplicationFactory ASP.Net ...
1
vote
1
answer
49
views
NUnit : How to prevent calling base class constructor or mocking base class constructor (ASP.NET MVC controller method testing with NUnit)
I am testing an ASP.NET MVC application with NUnit (on the .NET framework).
I am trying to test SomeController method which is inheriting from BaseController.
In BaseController, there is a ...
1
vote
1
answer
1k
views
How to write unit test case and Mock SmtpClient Send mail
I am writing unit test case for the below class Communication service. I have the below interface communicationservice .
I want to write the Nunit or unit test for the SendMail method which is present ...
0
votes
1
answer
413
views
How to mock the class method using NUnit test
Please let me know How do I Mock my "GetStatus" method which is available inside my controller.
This is my Test Method
public async Task ShouldReturnOKStatus()
{
var ...
1
vote
1
answer
1k
views
Print all test cases along with passed/failed using dotnet test/nunit console runner
I'm looking to print all the test cases along with their status(pass/fail) like below:
TestCaseOne --> Passed
TestCaseTwo --> Failed
TestCaseThree --> Passed
I have tried this from this link ...
0
votes
1
answer
338
views
How to run a web application project (ASP.NET MVC) within C#, NUnit project in Visual Studio 2022
I'm building a NUnit test project in Visual Studio (VS) 2022 in order to test an older web site (MVC 4, ASP.NET). I would like to run a Selenium WebDriver to test the older, MVC 4, web application in ...
0
votes
1
answer
179
views
I am Testing User Manager Functionality in asp. Net core clean Architecture, but user Manager method addClaim not working
I am mocked the UserStore and userManager and getting User by userManager method FindByIdAsync Correctly but when I send That User and one claim to AddClaim Function Its Giving me null value.
Here Is ...
0
votes
1
answer
148
views
AutoTest of all mappings in AutoMapperProfiles C#
The question is to make a test that will look at each mapping from the MapperProfile and do a mapping test through .Map(model)
For Example:
private static IMapper _mapper;
public MappingAll()
{
...
0
votes
1
answer
776
views
How to pass multiple tests names, as one value in "dotnet test --filter" option
I have this part of my feature scenarios
@ID-1
@Browser:Edge
@Browser:Chrome
Given
Scenario: 01.01
Given I have open website in Browser
When I open form
Then the element are visible
@ID-2
...
1
vote
1
answer
803
views
Dotnet test coverage always null
I have an issue with test coverage. When I run this command
dotnet test ../XZrcndee.sln --output ../coverage /p:CollectCoverage=true /p:CoverletOutput=results\coverage /p:CoverletOutput=..\results\...
0
votes
1
answer
582
views
No connection string could be found in the App.config file
Visual Studio Solution:
(Project 1) I have a ASP .NET Framework API project that uses Entity Framework to access to Database.
(Project 2) Now I created NUnit project that is calling methods of project ...
0
votes
1
answer
443
views
No suitable constructor was found using Playwright with NUnit
I have a base class as
public class PlaywrightFixture
{
public Task<IPlaywright> Playwright { get; set; } = default;
public Task<IBrowser> Browser { get; set; } = ...
0
votes
2
answers
4k
views
c# unit test httpclient postasync
I am very new to Testing. I am trying to understand how can I unit test since I do not really need to actually trigger these services but probably mock every step.
How can I unit test the following ...