xunit

Creating a IEqualityComparer<IEnumerable<T>>

回眸只為那壹抹淺笑 提交于 2019-12-08 02:53:10
问题 I'm using xUnit and it doesn't have a way to determine if 2 IEnumerable<T> are equal if T is custom type. I've tried using LINQ SequenceEqual but again as the instances of T are different this returns false; Here is a basic test with a non-working IEqualityComparer [Fact] public void FactMethodName() { var one = new[] { new KeywordSchedule() { Id = 1 } }; var two = new[] { new KeywordSchedule() { Id = 1 } }; Assert.Equal(one, two, new KeywordScheduleComparer()); } public class

placing asp.net 5 tests in separate assembly

耗尽温柔 提交于 2019-12-07 17:47:48
问题 I use Microsoft.AspNet.TestHost to host xunit integration tests. As Long as the tests are in the very same Project as the asp.net-5-solution everything works as it should. But I'd like to place the tests into a separate assembly, to separate them from the solution. But when I try to run the tests in the separate solution I get an error, TestServer can't find the views. Bsoft.Buchhaltung.Tests.LoginTests.SomeTest [FAIL] System.InvalidOperationException : The view 'About' was not found. The

XUnit in Visual Studio 2015 RC1 Update 1 doesn't find tests

限于喜欢 提交于 2019-12-07 17:17:08
问题 I created an ASP.NET 5 project in Visual Studio 2015, using the Preview Templates. I installed XUnit via NuGet, and I added an "xUnit Test Project (DNX)" to my solution. But my Test Explorer shows nothing, even though I have a public "Fact" test method in Class1.cs. When I "Run All Tests", the "Tests" output window is blank. My "Build" output window shows that 2 project build succeeds. (My ASP.NET 5 project, and my xUnit project.) When I either build or clean my solution, however, I get the

xunit.runner.visualstudio not working on Visual Studio 2013 Update 4

∥☆過路亽.° 提交于 2019-12-07 15:02:36
问题 I got the following constellation: Machine 1: - Windows 8.1 - Visual Studio 2013 Update 3. - XUnit Test Runner installed via "Tools" / "Extensions" Machine 2: - Windows Server 2012 (Hyper V Virtual Box) - Visual Studio 2013 Update 4 I've loaded a project, which I've created on Machine 1, on Machine 2. The project already contained Unit Tests which ran perfectly on Machine 1. The installation of the XUnit Testrunner via "Tools" / "Extensions" got unavailable recently. Therefore I installed the

Breaking the build in TeamCity if .NET Core unit tests running under Docker have code-coverage less than 90%

冷暖自知 提交于 2019-12-07 14:07:07
问题 I have recently been looking at Docker, and how I can use TeamCity to run .NET Core unit tests in Docker containers as part of my build pipe-line. I add this as the final line in my Dockerfile to be able to run tests: ENTRYPOINT ["dotnet", "test", "--verbosity=normal"] These Dockerfiles are then referenced in compose files which TeamCity builds and runs using docker-compose in the command line. I have this working successfully now. Next challenge is to break the build if unit/integration test

Xunit multiple IClassFixtures

独自空忆成欢 提交于 2019-12-07 06:36:42
问题 My question is How to setup multiple fixtures in one test class? But the constructor of Zoo class can not handle multiple fixtures. For exemple: public class Zoo : IClassFixture<Tiger>, IClassFixture<Wolf>, IClassFixure<Bird> { private IFixture fixture; public Zoo(IFixture fixture) { this.fixture = fixture; } [Fact] public void TestAnimal() { //Arrange int actualBonesCount = this.fixture.BonesCount; int expectedBonesCount = 2; //Act & Assert Assert.Equal(expectedBonesCount, actualBonesCount )

How to get passed and fail test case count in xunit using cake(c# make) script

久未见 提交于 2019-12-07 03:30:26
问题 I try to use the cake script for running the test cases written in Xunit using the cake script , I need to know the number of passed and failed test cases count. #tool "nuget:?package=xunit.runner.console" var testAssemblies = GetFiles("./src/**/bin/Release/*.Tests.dll"); XUnit2(testAssemblies); Reference : http://www.cakebuild.net/dsl/xunit-v2 Can anyone please suggest how to get the number of passed and failed test cases ? 回答1: You'll have to use XUnit2Aliases​.XUnit2(IEnumerable < FilePath

How to capture output with XUnit 2.0 and FSharp style tests

穿精又带淫゛_ 提交于 2019-12-06 20:36:05
问题 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 @> [<Fact>] let ``SomeOtherFunction should return 11`` () = let a = SomeFunction() test <@ a = 11 @> If I wish to log to the console from xunit ( according to http://xunit.github.io/docs/capturing-output.html ) one needs to write a constructor that takes an ITestOutputHelper and then use that instead of Console

Xunit not working using Visual Studio Team Services Build VNext

℡╲_俬逩灬. 提交于 2019-12-06 12:42:40
After following several blogs detailing how to get xUnit working with Team Services Build vNext: http://tech.trailmax.info/2014/01/run-xunit-in-hosted-team-foundation-service/ Running unit tests in TFS/VSO Build vNext using xUnit adapter http://www.donovanbrown.com/post/2015/06/15/how-to-run-xunit-test-with-vnext-build None of which worked for me. From examining the build logs I get the following warnings for each of my test assemblies. -------------------- Warning: [xUnit.net 00:00:00.1644156] Exception discovering tests from CHO.SAM.Business.Test: System.BadImageFormatException: Could not

Problems installing NoseXUnit

南楼画角 提交于 2019-12-06 12:19:59
I tried to install NoseXUnit using pip. Trying to run nosetests with it ends with the following error message: # nosetests --with-nosexunit /usr/lib/python2.7/site-packages/nose-1.3.0-py2.7.egg/nose/plugins/manager.py:395: RuntimeWarning: Unable to load plugin nosexunit = nosexunit.plugin:NoseXUnit: (coverage 3.7.1 (/usr/lib/python2.7/site-packages), Requirement.parse('coverage==2.85')) RuntimeWarning) Usage: nosetests [options] nosetests: error: no such option: --with-nosexunit So it seems like there's a problem with "coverage" version - I have version 3.7.1 and for some reason it requires 2