Skip to main content

All Questions

0 votes
1 answer
21 views

Can I use built-in Microsoft DI in unit tests for init objects?

in unit tests for init and create the objects I would like to use buit-in Microsoft DI, is it good practice?
Ershad Raoufi's user avatar
0 votes
2 answers
25 views

How to mock and perform asserts in MessageBox

I'm making a desktop/on-premise application using C# .Net Windows Forms and I need to perform some tests on a class that interacts with the user through messages while carrying out some processes, and ...
williamqmoura's user avatar
3 votes
0 answers
61 views

Problems discovering tests automatically using the TestPlatform in .NET

I am developing a unit testing framework with C#. I am using the official Microsoft.TestPlatform library and I have already implemented ITestDiscoverer and ITestExecutor. What I am using to determine ...
ElJorme's user avatar
  • 43
0 votes
0 answers
335 views

dotnet test cannot find "Plat Code Coverage"

I am trying to run code coverage using coverlet. My test projects are SDK style and have coverlet.collector installed, although some of the referenced projects are not yet in the SDK style. The ...
rbasniak's user avatar
  • 4,864
0 votes
1 answer
89 views

How do I correctly design my classes so that internal logic is unit testable?

I'm struggling to figure out how to correctly design code in a large codebase so that pieces of internal logic can be easily testable. Here's a made up example: public class SomeService { public ...
pseudodev's user avatar
0 votes
0 answers
47 views

How to make a unit test with SignInManager in .NET 6: Method not found

Here is my test that I try to make it pass: private ComptesController _comptesController; private SignInManager<ApplicationUser> _signInManager; private UserManager<...
mathdx's user avatar
  • 67
-1 votes
1 answer
27 views

How to create Moq for "Update a property of concrete class in a method using injected interface method"

I have this concrete class which implements an interface internal interface ITableAdapter { int CustomFill(Dataset dataset, ...); } internal interface IEntityRetriever { IEntity RetriveEntity(); }...
Uday's user avatar
  • 25
0 votes
0 answers
46 views

Cannot setup a mock on a Data Provider

So, I am trying to test a service by setting up a mock of one the data providers it uses. I set up my service and initialize it with an instance on the Mock.Object of my data provider. In my test case ...
KChimev's user avatar
  • 29
1 vote
0 answers
70 views

In-Memory Unit Tests

I'm attempting to do in-memory testing. I'm following this article. The article provides this template for setting up an in-memory test. My problem is occurring with the following section of the code ...
Kyle's user avatar
  • 49
0 votes
3 answers
1k views

Method to be called before any test (xUnit)

Is there any way to create method that will be automatically called before any test? [Fact] public void Test1() { } [Fact] public void Test2() { } private void Prepare() { // Prepare test ...
Kirill Dolbilov's user avatar
0 votes
0 answers
79 views

How to test html render in razor page

I'm trying to test html page of my razor page. This is my frontend: @page @model IndexModel @{ } <div class="container col-xxl-8 px-4 py-5"> <div class="row align-items-...
mathdx's user avatar
  • 67
0 votes
1 answer
74 views

Run a project before starting .Net Unit Tet

I have 3 projects made with .Net 7.0 The first is a REST API. The second is a REST Client. And the third is a Unit Test project. When I start the unit test I would like to start the server with a ...
jéjé's user avatar
  • 35
-1 votes
4 answers
1k views

How to Verify the parameters in Moq?

I am writing test case and getting compile error. Returns is not working in this below statement. //Moq //Error: '.' cannot be applied to operand of type 'void'. This gives error before "....
Alex Dave's user avatar
  • 108
0 votes
2 answers
298 views

Create multiple test scenarios for a method

I'm studying unit tests in dotnet and I have a doubt about the amount of scenarios that is acceptable to be done. Should I make just one test scenario for my method or should I create several ...
Silas Enrique's user avatar
1 vote
1 answer
39 views

Functional and non-functional test [closed]

I want to test the project I am working on before it publish it. I have done sytem test but I also want it to be tested by a focus group. My question is, is there a free available tool for testing my ...
user15425484's user avatar

15 30 50 per page
1
2 3 4 5
9