xunit Questions
1
Solved
I have xUnit tests which run fine locally but do not get run on Azure DevOps. The assembly under test is a .NET 5.0 assembly as is the test assembly.
Examining the log file from the VsTest task, I ...
Cingulum asked 27/1, 2021 at 22:23
1
Solved
I'm using Xunit and Moq for unit testing. So far I was able to succesfully mock and test methods from interfaces.
But how am I supposed to mock and test the methods of a class that I have no contro...
Berndt asked 21/1, 2021 at 17:35
1
What I can't understand fully is exemplified in a unit test below. Basically I want to know why DbContext overrides collection values currently stored in the database even if Reload() and a new loa...
Giarla asked 14/1, 2021 at 16:42
2
Solved
I'm new to unit testing, can anyone advise how to test public method (CreateUser) below using xUnit and Moq, thanks!
public async Task<bool> CreateUser(UserDTO newUser)
{
newUser.CustomerId...
Gratification asked 5/8, 2017 at 19:12
4
Solved
What's the point of using Fit/FitNesse instead of xUnit-style integration tests? It has really strange and very unclear syntax in my opinion.
Is it really only to make product owners write tests? ...
Monachism asked 28/2, 2009 at 23:11
3
Solved
I have a .NET Core project with xUnit. I can no longer run any tests with Resharper though. Even very simple tests are inconclusive. e.g.:
using Xunit;
public class MyTests
{
[Fact]
public void...
Levison asked 4/8, 2017 at 16:17
2
Solved
I created an asp.net core webapi project and created an coresponding xUnitTest for it. When I am running the UnitTest on my local maschine the UnitTest runs without any problems.
I use the XUnit wi...
Copperplate asked 27/3, 2020 at 18:27
1
Solved
My integration test is simple. I call to create application API and then check if application record is correctly inserted.
This is my CustomWebApplicationFactory:
public class CustomWebApplication...
Unearthly asked 16/11, 2020 at 10:46
2
I have an XUnit project that references and tests an API endpoint method of another project. When I run the test however I get the following error:
A test class may only define a single public con...
Rollie asked 20/5, 2020 at 23:48
1
Solved
In our Azure Pipelines pipeline we have .NET Core xUnit test methods that take an InlineData parameter. The test runner runs all test methods and correctly reports in its console output each Inline...
Predicate asked 20/10, 2020 at 5:37
3
Solved
I am trying to write unit tests for my controller class which retrieves a token with the following command:
string token = await HttpContext.GetTokenAsync("access_token");
Therefore I mocked th...
Purree asked 9/3, 2020 at 13:53
5
Solved
I'm trying to write an ASP.NET Core 2.2 integration test, where the test setup decorates a specific service that would normally be available to the API as a dependency. The decorator would give me ...
Toandfro asked 9/4, 2019 at 18:45
2
Solved
I need NUnit output from XUnit tests for a report. With NUnit I can do:
nunit-console.exe /xml=c:\TestResultN.xml MyDll.dll
I've tried:
xunit.console MyDll.dll /nunit TestResults.xml
but I g...
Rustic asked 13/12, 2010 at 17:21
4
I have, what is probably, a stupid question.
I'm trying to run an xunit dll from the command prompt.
I find that I need the following dlls to be in the folder that the command prompt is in.
xUn...
1
Solved
I'm using xUnit for implementing tests. I used to install the xUnit Visual Studio runner, xunit.runner.visualstudio nuget package to run tests using the VS GUI.
Below is are xUnit-related branches ...
Coagulate asked 7/9, 2020 at 16:25
5
Solved
I am trying to test a class that only has a private constructor. This is for a course registration system. The courses do not get create via our application, therefore we intentionally have no publ...
Leatherjacket asked 13/8, 2020 at 17:17
5
I am writing test cases using xUnit and Moq.
I am trying to mock PostAsync() of HttpClient, but I get an error.
Below is the code used for mocking:
public TestADLS_Operations()
{
var mockClie...
Dare asked 18/7, 2019 at 9:33
1
Solved
I am not sure how to pass arguments from Setup() to Returns() in Moq.
Here is an example:
public static IInterfaceHandler GetInterfaceHandlerMoq()
{
// Defining the moq
var moq = new Mock<IInt...
2
How is it recommended to write to the console in .NET CORE 2.0 C# functions which link either into a console app or a xUnit test?
I've had some luck with simply Console.WriteLine, but only with do...
1
Solved
I'm learning and practicing CQRS and Unit Test in C#. I need to know how to unit test Command Handlers in CQRS.
Here is my CreateAuthorCommand:
public sealed class CreateAuthorCommand : ICommand<...
Grogram asked 15/8, 2020 at 18:23
0
I have a xunit test with Theory and some InlineData. The theory has set the DisplayName property. The test window is showing a test for each InlineData with correct DisplayName but is showing too, ...
Vessel asked 15/8, 2020 at 13:34
2
Solved
I notice when I start up Visual Studio 2019, I am unable to create a .NET Framework version of XUnit or NUnit (only MSTests). We have been mandated to use XUnit tests, but our solution is all .NET ...
Boothman asked 16/7, 2019 at 18:20
2
Solved
Using xUnit.net what would be a clean (readable/understandable and maintainable) way to reuse the same test for multiple implementations of the same interface?
The act and assert part of my tests...
Whacky asked 4/3, 2014 at 9:37
4
Solved
In xUnit 2.2 and prior versions, we were able to pass date strings as inline data when implementing a Theory.
[Theory]
[InlineData("title 1", "testing 1", 1, "Educational", "2017-3-1", "2018-12-3...
2
Solved
I'm porting a small library that I have on NuGet to .NET Core.
I've created .NET Standard 1.6 class libraries for the main project and the tests, and copied over the code. I changed the unit tests...
© 2022 - 2024 — McMap. All rights reserved.