Click here to Skip to main content
15,886,806 members
Everything / XUnit

XUnit

XUnit

Great Reads

by Nick Polyak
This article explains Test Driven Development using XUnit with a detailed sample.
by Akram El Assas
TDD in C# through a simple example
by Sean Rand
Getting the most from your test runner
by Bohdan Stupak
A short take on brittle unit-tests and how to avoid them

Latest Articles

by Akram El Assas
Microservices sample architecture using ASP.NET Core, Ocelot, MongoDB and JWT
by Akram El Assas
TDD in C# through a simple example
by Nicolas DESCARTES
How to leverage Selenium for UI tests?
by Zijian
From MsTest to xUnit

All Articles

Sort by Score

XUnit 

30 Jan 2022 by Nick Polyak
This article explains Test Driven Development using XUnit with a detailed sample.
23 Mar 2024 by Akram El Assas
TDD in C# through a simple example
19 Oct 2018 by Sean Rand
Getting the most from your test runner
18 Apr 2022 by Bohdan Stupak
A short take on brittle unit-tests and how to avoid them
14 Aug 2023 by Daan Acohen
Explains how to do multiple assertions using the Fluent Assertions library, without multiple validation lines
5 Dec 2018 by CHill60
Try adding this using Xunit; after your existing using statements
21 May 2020 by Daan Acohen
An explanation of how to test validation attributes with xUnit
5 Jan 2022 by Richard Deeming
That error means you're trying to access a method or property on an object which has not been initialized. At a guess, it's probably the protected readonly DatabaseContext db; field in your UnitOfWork class, which is not initialized by any of...
2 Jun 2020 by Daan Acohen
A description of how you can let the HttpClient client do exactly what you want and test for that with xUnit
24 Nov 2023 by Zijian
From MsTest to xUnit
13 Dec 2023 by Nicolas DESCARTES
How to leverage Selenium for UI tests?
12 Nov 2018 by Vlad Neculai Vizitiu
Automation testing dogma and exploration
4 Dec 2018 by Member 14078144
I am using xunit for testing my project. I was added all dependencies but i am getting following error. The type or namespace name 'TestServer' could not be found (are you missing a using directive or an assembly reference?) My test3.Tests.csproj dependencies
1 Mar 2019 by Member 14167830
The continuous integeration pipeline fails wit the following error Unable to find D:\a\1\s\ApplicationTemplateTestCases\obj\Debug\netcoreapp1.1\testhost.dll. Please publish your test project and retry Can you please tell us the possible reasons for this issue? What I have tried: I have...
10 Feb 2020 by phil.o
A raw search seems to yield interesting results which should be investigated: selenium xunit desktop testing[^]
23 Feb 2020 by Richard MacCutchan
This forum is for technical programming questions. Google is the place for searches.
23 Feb 2020 by OriginalGriff
We are not here to search the internet for you: Particularly when a trivial google search using part of your question gives so many results: Selenium C# xUnit Testing Videos or any tutorials - Google Search[^] Google is your friend: Be nice and...
16 Apr 2020 by Member 14803912
Please help me how do I write a test for the following controller without changing the program code ??? ***ProductController:*** [HttpPost] [ValidateAntiForgeryToken] public async Task CreateProductAsync(ProductDTO objProduct) { ...
16 Apr 2020 by F-ES Sitecore
You can't, if you want your code to be unit testable you have to write it with unit testing in mind.
20 Apr 2022 by Dawood507
My service class which have interface and injected service. public class SomeService { private readonly ICustomConfigManager _customConfigManager; private readonly IList _defaultRoleSettings; public...
11 Aug 2022 by Virendra S from Bangalore, Karnataka
public ProductConfigDetails GetProductConfig() { ProductConfigDetails ProdConfigDetails; if (appsettingsconfiguration.UseMockData) { taxConfigDetails =...
10 Sep 2022 by lalit.mca2006
Hi, I am using below code to upload file(IformFile) using swagger. I came to know that in new framework we must implement IOperationFilter . Here is my code: using Microsoft.OpenApi.Models; using Swashbuckle.AspNetCore.SwaggerGen; ...
27 Oct 2022 by Graeme_Grant
Google search is your friend. 1. NUnit: nunit bool check - Google Search[^] finds this: Assert.True | NUnit Docs[^] 2. XUnit: xunit bool check - Google Search[^] finds this: Xunit.Assert.Equal(bool, bool) Example[^] For XUnit, I like using: ...
30 Mar 2023 by Virendra S from Bangalore, Karnataka
GetAbsoluteExpirationValue() SonarQube report says, this method is partially covered(Partially covered by tests, 1 of 2 conditions). But Resharper shows 100 % coverage. Can you help me what am I missing here? public MemoryCacheEntryOptions...
30 Mar 2023 by Richard Deeming
ReSharper is wrong. You test what happens when the configuration contains an invalid value; but you never test what happens when the configuration contains a valid value. There are four paths you need to test: ...
23 Mar 2024 by Akram El Assas
Microservices sample architecture using ASP.NET Core, Ocelot, MongoDB and JWT
8 Nov 2018 by Lee P Richardson
Code coverage is finally easy in .NET Core
4 Feb 2017 by Dave Clemmer
Using XUnit.net to develop some unit tests, using Fact and Theory form of testing, including happy path tests and tests expected to throw exceptions
24 May 2020 by Daan Acohen
By using xUnit the right way, your logging can be improved and production problems can be solved easily or even prevented
13 Dec 2018 by Kaj Bromose
FakeItEasy, AutoData and InlineAutoData in action
16 May 2022 by freedeveloper
How to create a data access class in a way, that is possible to execute unit test on it
26 May 2020 by Daan Acohen
Some functionality of Moq can be really important but can also be easily forgotten as explained here
10 May 2020 by Daan Acohen
The test problems you face when having a database dependency and how to resolve these problems
19 Oct 2023 by Daan Acohen
Boost your xUnit tests with detailed logging for clearer insights and easier debugging.
10 Feb 2020 by Mohammad Nawaz
How can we do as I am very new to both Selenium and C# x Unit testing What I have tried: As I am very new to Selenium and xunit I haven't d o anything
5 Jan 2022 by SajjadZare
I use UnitOfWork with repository in WebAPI dotnet 6 and want to use XUnit for test I use below code but when run the test the result is: System.NullReferenceException : Object reference not set to an instance of an object. What I have tried: ...
3 Feb 2022 by bmw318mt
I am checking a log entry and I am in a dilemma what best to use assert.single or assert.notempty Assert.Single(Logs.GetPlayerLogs(user, group) .Where(l => l.Severity == LogSeverity.Info && l.Category == LogCategory.Verbose &&...
20 Apr 2022 by Dawood507
Actually I was sending dummy data in 'FakeDefaultRoleSetting' json method, when I convert it to real data, the issue gone. Thanks all for support.
27 Oct 2022 by Virendra S from Bangalore, Karnataka
I am new to unit testing, please help me with writing correct unit tests for below method. Functionality: It just calls one method internally & get the object, based on object value returns true/ false. public bool...