xunit Questions

1

I have for several project a common util project which consits of some base test classe, helper class and so on. The project definition looks like this: <Project Sdk="Microsoft.NET.Sdk"> &...
Ingridingrim asked 18/5, 2020 at 7:6

5

Solved

When a test hangs in a loop, the small green progress bar in the test runner does not proceed, but there is no way to stop the test run. Or is there? VS 2013 Edit: This occured when using the XUn...
Saccharate asked 22/1, 2014 at 18:35

3

I'm running some tests in an Azure Devops pipeline and I'm seeing some failures on the build agent that I don't get locally. I'm trying some low-fi debugging and want to write some chatter out to t...
Cleres asked 19/7, 2019 at 14:40

3

Solved

I added a method to my controllers to get the user-id from the JWT token in the HttpContext. In my unit tests the HttpContext is null, so I get an exception. How can I solve the problem? Is there...
Mccrary asked 20/11, 2019 at 9:16

3

Solved

I have a new issue working on migrating my Xunit integration test on .net core 3.0. I moved the project in a subfolder and now I have a DirectoryNotFoundException. TestServerFixture: public class...
Gamosepalous asked 9/12, 2019 at 17:14

2

Solved

I have a library that contains some classes, which I need in several Unit Test projects. The library should be deployed as a NuGet package in my private repository. I already deployed some NuGet pa...
Nawab asked 14/5, 2019 at 7:1

4

Solved

How can I find Multiple Assertions or Soft Assert in xUnit? I found Nunit has below ability, trying to find similar options in xUnit. Assert.Multiple(() => { Assert.AreEqual(expectedResult1, ...
Forsooth asked 25/11, 2019 at 12:20

2

Solved

I heavily use the Autofixture AutoData Theories for creating my data and mocks. However this prevents me from using the InlineData Attributes from XUnit to pipe in a bunch of different data for my ...
Fertilize asked 11/5, 2016 at 17:9

1

So we are using the CQRS pattern in our applications using MediatR. I am working on a basic CRUD API, with the following stipulations: The GET call needs to use QueryHandlers, Dapper, SQL to retri...
Healthful asked 8/10, 2020 at 22:29

2

I have the following Unit test using XUnit: [Theory] [InlineData(1, 2, 3)] [InlineData(-2, 2, 0)] [InlineData(int.MinValue, -1, int.MaxValue)] public void CanAddTheory(int value1, int value2, int ...
Neldanelia asked 8/5, 2019 at 16:27

2

Solved

Normally I write my unit tests in F# as open Swensen.Unquote open Xunit module MyTests = [<Fact>] let ``SomeFunction should return 10`` () = let a = SomeFunction() test <@ a = 10 @&...
Alveolus asked 12/8, 2015 at 14:22

1

Solved

I am writing unit tests using Moq in xUnit for a service that involves CosmosDB. There's a method GetVehicleInfo which returns ItemResponse<VehicleInfo> from CosmosDB. As ItemResponse has a p...
Cesspool asked 10/2, 2022 at 11:40

3

I have a ASP.NET Core MVC API with controllers that need to be unit tested. Controller: using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using System.Threading.Tasks; n...
Edgerton asked 1/2, 2018 at 12:7

1

Solved

In .NET Core 3.1 and .NET 5, we had an Xunit test like the example below. It makes sure every Controller has an AuthorizeAttribute to prevent security leaks. When upgrading our web project to ASP.N...
Goble asked 7/2, 2022 at 22:52

9

I keep getting this error while using XUnit for .NET 1.0 framework net46. The following constructor parameters did not have matching fixture data I have seen this post: Collection fixture won&#39...
Shipboard asked 11/9, 2016 at 21:45

2

I am using xUnit for integration testing. and for that, I use a localdb instance for it. With that being said, I would like to initiate DB instance once with some pre-defined data and of course I w...
Ajax asked 5/5, 2020 at 0:0

1

Solved

I am trying to create a unit test using Moq which test Microsoft.AspNetCore.Identity user manager. I know that Moq is good for mocking interfaces, but UserManager does not have interface. Here is m...
Brack asked 18/12, 2021 at 11:15

3

Solved

Having what appears to be runtime issues with Project References in Visual Studio 2017 Test Runner. The Unit Test CSPROJ builds just fine with TargetFramework=net47, but at execution time we get th...
Karttikeya asked 9/5, 2017 at 15:29

8

Solved

I'm using xUnit with the ReSharper test runner and the xUnitContrib resharper plugin. When I have a long-running test, I'd like to be able to output some progress indicator to the Unit Test Output...
Ahron asked 26/2, 2013 at 15:6

2

Solved

We have some UI integration tests that can't be run on the build server as launching test GUI app requires running the build agent as an user (instead of a service which is how it's currently setup...
Ingather asked 15/9, 2021 at 16:23

6

I have some methods that rely on some random calculations to make a suggestion and I need to run the Fact several times to make sure is ok. I could include a for loop inside the fact i want to tes...
Dry asked 7/8, 2015 at 9:5

2

I used Fluxor for state management in in one of the razor components in my Blazor app and I'm not really sure how to set it up for testing with Moq. I can't just assing a value to students because ...
Towhee asked 22/5, 2021 at 5:14

5

Solved

I am a newbie to XUnit and Moq. I have a method which takes string as an argument.How to handle an exception using XUnit. [Fact] public void ProfileRepository_GetSettingsForUserIDWithInvalidArgume...
Daphne asked 10/7, 2017 at 16:30

2

Each one of my XUnit test projects has an appsettings.json file that specifies a few settings. I have always used dependency injection with IConfiguration to retrieve these settings in my Test Fixt...
Schoolmarm asked 17/4, 2018 at 18:46

2

Solved

I'm trying to understand how to do integration tests on ASP.NET Core 6 web API controllers. I've tried following all the guides, SO posts and recommendations I could find but for some reason I keep...
Paid asked 15/10, 2021 at 14:21

© 2022 - 2024 — McMap. All rights reserved.