xunit Questions

3

Solved

I am using xUnit with Visual Studio Test Explorer and when there's an error in Assert.Equal(), I am getting a truncated version of Actual and Expected. For example, Xunit.Sdk.EqualException Asser...
Proclamation asked 13/9, 2017 at 20:9

1

i have problem with xunit, its skipping all tests without any message or error, i'm using ubuntu 20.04 but on windows 10 i have the same problem michael@michael-System-Product-Name:~/gradebook$ cd ...
Aphesis asked 28/1, 2021 at 16:49

5

Solved

I am currently evaluating Visual Studio for Mac. And I ran into a little problem. It won't detect any of my xUnit unit tests. On the Windows version of VS, the tests are automatically picked up whe...
S asked 30/11, 2016 at 5:4

5

Solved

For layouting we have our famous "Lorem ipsum" text to test how it looks like. What I am looking for is a set of files containing Text encoded with several different encodings that I can use in my...
Merocrine asked 8/2, 2012 at 9:8

2

Solved

I'm testing an endpoint. I need to figure out how to get the test to pass with my loggerMock. Here is how I currently have the test set up: public void GetExceptionReportSessionData_Returns200OK()...
Quach asked 29/5, 2020 at 17:2

2

Solved

I am facing highlighted issue while writing test cases with xUnit and Moq in .Net Core I have written below test case using MSTest Fakes .It is working fine as expected. [TestClass] public class...
Cumings asked 11/7, 2019 at 12:51

5

Solved

I've got a time-triggered Azure Function which I want to test with XUnit and MOQ. While I know I need to call the Run method of the class using an instance of the class say funTimeTriggeredObj wh...
Wharfinger asked 1/4, 2020 at 8:59

2

Solved

Given a .Net 5 solution with multiple xUnit test projects I can run dotnet test from the root of the solution and it will run all the tests. I would like to generate reports so based on https://lea...
Iseabal asked 12/7, 2021 at 13:15

3

In xUnit and Visual Studio, I would like to group tests marked with the [Collection("DB")] attribute in the Test Explorer. I can group test by the [Trait("Collection", "DB")] attribute only. Is the...
Mahdi asked 11/3, 2016 at 9:39

3

Solved

I'm fairly new to Unit Testing and have the following code: public class PowerOf { public int CalcPowerOf(int @base, int exponent) { if (@base == 0) { return 0; } if (exponent == 0) { return 1; ...
Matrilineal asked 26/2, 2017 at 10:18

46

Solved

EDIT 2016-10-19: The original question was about an issue specific to VS2015 CTP6 with the XUnit test runner. It's clear from the answers that there is a much broader issue with unit test discover...

1

I have a working web API that I recently updated to use JWT auth and, while it is working when I run it normally, I can't seem to get my integration tests to work. I wanted to start working on inte...
Goggin asked 7/2, 2021 at 1:48

2

Solved

I recently installed VS2019 Prof 16.2 and experience following error when loading .coverage files: Microsoft Visual Studio Exception was thrown: Could not load file or assembly 'Microsoft.VisualSt...
Unseen asked 3/8, 2019 at 20:55

3

System.InvalidOperationException: Relational-specific methods can only be used when the context is using a relational database provider. Getting the above mentioned error while using InMemoryData...

2

Solved

How do I mock code like this in my unit test. I'm using xUnit and Moq in asp.net core 5. I'm new to xUnit and Moq. var url = configuration.GetSection("AppSettings").GetSection("SmsAp...
Cormier asked 1/5, 2021 at 17:55

3

Solved

I have a ASP.Net Core 3 project with Visual Studio Professional 19.4.1 with xUnit 2.4.0. I have a couple of tests written there. My problem is that Visual Studio shows all the tests in this project...
Shadow asked 16/12, 2019 at 4:48

5

Solved

I'm pretty new to xUnit and here's what I'd like to achieve: [Theory] [InlineData((Config y) => y.Param1)] [InlineData((Config y) => y.Param2)] public void HasConfiguration(Func<Config, s...
Heartburn asked 25/7, 2017 at 9:39

4

I'm trying to compare the precision of two numbers with some tolerance. This is how it was being checked in nUnit: Assert.That(turnOver, Is.EqualTo(turnoverExpected).Within(0.00001).Percent); I'm ...
Rhine asked 9/8, 2019 at 10:48

2

I have a DbContext which has a Dbset without Key. It works in the application, which only queries the table. public class MyDbContext : DbContext, IMyDbContext { public MyDbContext(DbContextOption...
Semiskilled asked 16/12, 2019 at 19:43

4

Solved

I am working on an ASP.Net Core MVC Web application. My Solution contains 2 projects: One for the application and A second project, dedicated to unit tests (XUnit). I have added a reference to th...
Armentrout asked 19/6, 2018 at 6:12

5

Solved

Using EF Core (or any ORM for that matter) I want to keep track of the number of queries the ORM makes to the database during some operation in my software. I've used SQLAlchemy under Python earli...
Swastika asked 28/4, 2017 at 12:22

2

Solved

I have build a WebAPI and apart from my tests running on Postman I would like to implement some Integration/Unit tests. Now my business logic is very thin, most of the time its more of CRUD action...
Sorcim asked 27/12, 2016 at 16:59

3

I am writing a Unit Test and need to mock Entity Framework's .FromSqlRaw method. When the method is executed in the class under test, it throws following exception: System.InvalidOperationExceptio...
Affectionate asked 11/10, 2020 at 9:1

3

I have a Class Library, it contains the following Model and Method Model: public class Employee { public int EmpId { get; set; } public string Name { get; set; } } Method: public class Emplo...
Belligerence asked 9/5, 2017 at 15:44

2

I have about 100 selenium tests to run, but 2 of them cannot be run in parallel Is it possible to disable parallelism only for those 2 tests, using xUnit? (those 2 test cannot be parallel, beca...
Trivet asked 7/2, 2018 at 7:48

© 2022 - 2024 — McMap. All rights reserved.