xunit Questions

1

Solved

We are creating an Integration Unit test (Xunit), which is calling the Real Application Startup.cs. For some reason, Real project can read Configuration file/property correctly, however running it...
Saltigrade asked 1/8, 2019 at 23:20

1

My Visual Studio does discover my Xunit tests, but "run all" (ctrl+R, A) doesn't run them. I can however manually select these tests to run them. Console output: ========== Discover test finished...
Silkaline asked 6/7, 2017 at 19:18

1

I am trying to unit test a parser that parses a string and returns the corresponding abstract syntax tree (represented as a discriminated union). I figured it would be pretty compact to use Xunit.E...
Homophonic asked 31/12, 2014 at 20:30

2

I use XUnit to run unit tests in C# code. I have many abstract unit tests classes, which take one standard extra fairly complicated parameter (in comparison to a standard XUnit test class setup). ...
Publus asked 15/8, 2018 at 2:33

2

Solved

I am writing test cases using xUnit and Moq. I am using below code in Test class for testing catch() of another class method private readonly IADLS_Operations _iADLS_Operations; [Fact] public vo...
Barium asked 18/7, 2019 at 12:51

3

Solved

Using Xunit, how can I get the name of the currently running test? public class TestWithCommonSetupAndTearDown : IDisposable { public TestWithCommonSetupAndTearDown () { var nameOfRunningTest...
Solitary asked 10/5, 2013 at 14:41

2

Solved

Here is what I want to achieve with xUnit: Run initialization code. Run tests in parallel. Perform teardown. I have tried [CollectionDefinition]/[Collection]/ICollectionFixture approach descri...
Goran asked 1/2, 2018 at 7:31

0

I am using .Net Core2.2. I've an API project with environment variables. These variables are injecting on CI. What I want to do is, when I run my integration tests, it should fire up the API proj...

2

Solved

I am trying to test the following filter: using Microsoft.AspNet.Mvc; using Microsoft.AspNet.Mvc.Filters; namespace Hello { public class ValidationFilter : ActionFilterAttribute { public overr...
Megdal asked 14/4, 2016 at 16:56

1

Solved

The following constructor parameters did not have matching fixture data for unit testing using moq and xunit. Already using dependency injection and mock to test the class. //this is how i regi...
Decimal asked 25/6, 2019 at 12:33

1

For running Protractor end to end tests in xunit I want to Combine Class Fixtures and Collection Fixtures in xunit. I created a collection fixture DatabaseServerFixture[Collection] to run the datab...
Millionaire asked 20/1, 2017 at 15:56

5

I'm trying to debug my .NET Core xUnit tests in VS 2017 RC. I run my tests via the Test Explorer window. While right-clicking a test and selecting Run Selected Tests works fine, selecting Debug Sel...
Ashcraft asked 25/12, 2016 at 20:51

3

Solved

I have some integration tests using xUnit that need to tear down some resources created during the test. To do that, I have implemented IDisposable in the class containing the tests. The problem i...
Natiha asked 31/5, 2019 at 6:10

1

Solved

I am in the process of adding integration tests at work for an MVC app. Many of our endpoints have policies applied to them, e.g. namespace WorkProject { [Route("A/Route")] public class WorkCont...
Dalesman asked 30/5, 2019 at 13:30

3

I have the following XUnit test in a project created with dotnet new xunit: type Scenarios(output : ITestOutputHelper) = [<Fact>] member __.``Output shows up`` () = output.WriteLine("I'm...
Undulant asked 9/3, 2018 at 14:34

1

Solved

xUnit gives us DisplayName property for [Fact] attribute to specify how our test should be displayed in test explorer in Visual Studio. For example: public class BooksIntegrationTests { [Fact(Dis...
Rhizotomy asked 10/5, 2019 at 15:58

0

This Collect screenshots and video azure-devops page describes how to attach files to test reports generated while running tests with MSTest. The page links to a github repo where a class is provi...
Blocky asked 2/5, 2019 at 9:21

2

Solved

In these days I'm trying to understand how xUnit tests work and, in particular, I discovered that there are 3 ways to pass data as parameters in order to test class methods (InlineData, ClassData a...
Reiser asked 30/4, 2019 at 14:38

1

Solved

I am looking for the way to customize xUnit attribute, possibly, to retry the test on a specific Exception of the test. Something like [Fact] [Retry(3, typeof(ArgumentException)] Is there any...
Pliam asked 20/4, 2019 at 20:57

2

what i am testing. This is an identity server project with a login to federated gateway. I do not control this gateway and am having issues with them not returning the proper claims back to me tha...
Usanis asked 10/4, 2019 at 10:23

2

Solved

I have created a simple action filter in my ASP.NET Core application, this action filter is suppose to log user's activity: public class AuditAttribute : IResultFilter { private readonly IAuditSe...
Cyme asked 3/12, 2016 at 16:29

2

Solved

I'm writing xUnit unit test cases for a dotnet core application which uses DocumentDB (CosmosDB) as storage. The unit test are written to execute against the local cosmos db emulator. On the Azure ...
Tchao asked 4/3, 2019 at 6:12

2

Solved

I am trying to work out how to add unit testing to my project. I thought it was best to start with a blank project and work it out from the start rather than adding it to my main project. Once I un...
Subcelestial asked 29/3, 2019 at 7:52

2

I have written custom model binder for a property. Now I am trying to write unit test for the same but not able to create object for model binder. Can anyone help me ? Below is the code for which I...
Jaime asked 24/12, 2018 at 5:47

1

Solved

I have some message consumers that take dependencies through the constructor, and I would like to cover them in unit tests. Does MassTransit's test harness provide a way to register consumers with ...
Briar asked 14/3, 2019 at 18:0

© 2022 - 2024 — McMap. All rights reserved.