Questions tagged [xunit]
xUnit.net is a free, open source, community-focused unit testing tool for the .NET Framework
12 questions
2
votes
1
answer
240
views
Unittesting in .NET 6 with XUnit
I'm trying to learn and write best practice unittests and practice test driven design. Can you give me some tips and review my code?
...
2
votes
1
answer
187
views
Conventional C# for LinkedList with (non-)nullable references + xunit tests
I'm new to C# and would appreciate any feedback you might have on the following doubly-linked list implementation, particularly WRT the following language features:
Exception handling
Debug.Assert
...
3
votes
1
answer
945
views
CRUD integration test, is it ok?
I want to test my CRUD operation to a MySql database (I use dapper as my ORM).
This is what I wrote with ...
4
votes
2
answers
324
views
Mock Atm program basic functions and xUnit unit test
For self learning purpose, I have created some xUnit unit test for these 2 Atm classes. At the moment, data is store in the in-memory object. This version is extended from previous version. For ...
2
votes
1
answer
121
views
Atm program xUnit unit test
I have these 3 methods for ATM mock program.
...
5
votes
1
answer
905
views
c# writing tests for WriteFileOuput
I am new to writing unit tests and i am facing some difficult writing unit tests for this class.
I am using Xunit and moq.
...
2
votes
1
answer
594
views
Testing an action returns a View with a ViewModel using xUnit and Moq
This is my first test, I think it's testing what I need it to test but wanted to get some feedback.
I wanted to test to make sure the controller action returns a view with a certain ViewModel.
The ...
3
votes
3
answers
451
views
Robot Name - Exercise
Robot Name
Manage robot factory settings.
When robots come off the factory floor, they have no name.
The first time you boot them up, a random name is generated in the format
of two ...
-2
votes
1
answer
475
views
How to test that an event will not be fired in xUnit? [closed]
I have two questions.
Does it make sense to test that an event will not be fired?
If yes, what is the best way to accomplish that using the xUnit framework?
For ...
3
votes
1
answer
236
views
Basic Unit Test of Application Service, setup and cleanup methods
I'm not experienced with testing, therefore I'd like you to look at my code proposal of unit test. My solution has following projects
Tests\Application.Tests
Application
Domain
Infrastructure
Web
And ...
2
votes
1
answer
398
views
Idiomatic way to write proper F# (x)unit + fsunit tests?
I am writing some unit tests using XUnit in F# and I am wondering what is the most idiomatic way in the F# sense to write them.
Let's start a simple case:
...
3
votes
1
answer
159
views
Assigning test-data parameters by name
When creating data-driven tests with xUnit we can use the MemberDataAttribute to get the data from a member of this or other ...