Questions tagged [xunit]

xUnit.net is a free, open source, community-focused unit testing tool for the .NET Framework

Filter by
Sorted by
Tagged with
1 vote
1 answer
102 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? ...
user avatar
1 vote
1 answer
85 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 ...
user avatar
3 votes
1 answer
474 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 ...
user avatar
4 votes
2 answers
152 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 ...
user avatar
2 votes
1 answer
46 views

Atm program xUnit unit test

I have these 3 methods for ATM mock program. ...
user avatar
4 votes
1 answer
219 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. ...
user avatar
2 votes
1 answer
86 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 ...
user avatar
  • 107
3 votes
3 answers
235 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 ...
user avatar
  • 620
-2 votes
1 answer
157 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 ...
user avatar
  • 105
3 votes
1 answer
83 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 ...
user avatar
  • 133
2 votes
1 answer
214 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: ...
user avatar
  • 1,101
3 votes
1 answer
105 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 ...
user avatar
  • 43.8k