xunit

How to run xUnit 2.1.0-beta-* for DNX projects with ReSharper

大憨熊 提交于 2019-12-24 04:05:30
问题 How to run xUnit 2.1.0-beta-* for DNX projects with ReSharper? When the ReSharper do find the tests, it fails on running them with System.IO.FileNotFoundException that indicates the unit test assembly is not found. Due to my understanding, DNX projects do NOT generate assemblies in \bin folder when they are compiled with VisualStudio 2015. Is there a way to force DNX projects generate assemblies like the tranditional class libraries projects? Any ideas? 回答1: DNX tests aren't currently

How to run xUnit 2.1.0-beta-* for DNX projects with ReSharper

不羁的心 提交于 2019-12-24 04:05:11
问题 How to run xUnit 2.1.0-beta-* for DNX projects with ReSharper? When the ReSharper do find the tests, it fails on running them with System.IO.FileNotFoundException that indicates the unit test assembly is not found. Due to my understanding, DNX projects do NOT generate assemblies in \bin folder when they are compiled with VisualStudio 2015. Is there a way to force DNX projects generate assemblies like the tranditional class libraries projects? Any ideas? 回答1: DNX tests aren't currently

Problem in casting Generic.List to System.Threading.Task.Generic.List

a 夏天 提交于 2019-12-24 01:17:16
问题 I am trying to create mock of IMemoryCache.TryGetValue method but it returns the following error when it hit cache.Get(cacheKey) : Unable to cast object of type 'System.Collections.Generic.List 1[ConnectionsModel]' to type 'System.Threading.Tasks.Task 1[System.Collections.Generic.List`1[ConnectionsModel] Here is the mock: private static Mock<IMemoryCache> ConfigureMockCacheWithDataInCache(List<ConnectionsModel> auth0ConnectionsResponse) { object value = auth0ConnectionsResponse; var mockCache

VSTest-Task not running .NET Core 2.1 xUnit-Tests from Test-plan

核能气质少年 提交于 2019-12-23 19:01:39
问题 I'm trying to create a release pipeline in VSTS that runs my xUnit-tests as specified in a Test Plan . Long story short: I can't get it to work. What I'm using: Azure DevOps (formerly VSTS) Visual Studio Test task (v2.*) Test project targeting .NET Core 2.1 xunit 2.4 with xunit.runner.visualstudio 2.4 In Azure DevOps I defined a Test Plan that contains a Test Suite which contains a Test that has an Associated Automation which points to my xUnit test. I had to use the REST API to link the test

Only first logging shows unless forcefully disposing

◇◆丶佛笑我妖孽 提交于 2019-12-23 18:22:38
问题 I'm using vs 2017, writing a netcoreapp2.0 library, and testing it with a UnitTest project (XUnit and NUnit give same results). I've noticed that unless I'm forcefully Disposing of my Serilog logger, only the first line will end up in Seq . Here are my 2 classes. The library one: public class Class1 { public static Logger _log; public Class1(Logger log) { _log = log; _log.Verbose("Class 1 constructor fineshed"); } public void LogMessage(string s) { _log.Debug("Got message: {Message}", s); } }

How to set up Selenium and ChromeDriver to run in headless mode

让人想犯罪 __ 提交于 2019-12-23 18:10:20
问题 I am trying to run a browser test using xUnit, Selenium, and Chrome Canary (headless mode) but I keep getting this error: OpenQA.Selenium.WebDriverException The HTTP request to the remote WebDriver server for URL http://localhost:58692/session timed out after 60 seconds. Here's my code: var chromeOptions = new ChromeOptions { BinaryLocation = @"C:\Users\<USERNAME>\AppData\Local\Google\Chrome SxS\Application\chrome.exe", DebuggerAddress = "127.0.0.1:9222" }; chromeOptions.AddArguments("no

Can a particular constructor argument of an injected SUT using Autodata xUnit Theories?

最后都变了- 提交于 2019-12-23 16:31:23
问题 Consider the following test, [Theory, MyConventions] public void GetClientExtensionReturnsCorrectValue(BuilderStrategy sut) { var expected = ""; // <--??? the value injected into BuilderStrategy var actual = sut.GetClientExtension(); Assert.Equal(expected, actual); } and the custom attribute I'm using: public class MyConventionsAttribute : AutoDataAttribute { public MyConventionsAttribute() : base(new Fixture().Customize(new AutoMoqCustomization())) {} } and the SUT: class BuilderStrategy {

Error: “Spatial types and functions are not available for this provider”

本小妞迷上赌 提交于 2019-12-23 15:29:43
问题 I'm getting the error: Spatial types and functions are not available for this provider, because the assembly "Microsoft.SqlServer.Types" version 10 or higher could not be found. I'm only getting this error on one of my dev machines - on the other, it works correctly. Both machines have SQL Server 2014 installed on them, which ought to be enough, but apparently it's not. Beyond that, I've installed the nuget package "Microsoft.SqlServer.Types" in the solution (I've tried it in several of the

Am I doing something wrong combining dotMemory, xUnit and async

两盒软妹~` 提交于 2019-12-23 12:33:03
问题 I have a unit test where I try to verify that I have disposed of a document that was once attached to the main user interface. The unit test has to be async in that everything needs to be run under an STA thread and I have to await the user interface being created. I have a helper that dispatches actions onto an STA thread. I create the memory object in the main body of the test and then pass it to the async methods as below. See the lines of code commented with ### to see the actual problem

Autofixture and WebApi Controller

一曲冷凌霜 提交于 2019-12-23 12:04:12
问题 I am using AutoFixture to try to test my controllers for a WebApi site. I am using the AutoData feature with Moq as noted on Ploeh's blog. My controller takes an IDepartmentManager in the constructor. Here is my test: [Theory, AutoMoqData] public void GetCallsManagerCorrectly( [Frozen]Mock<IDepartmentManager> departmentManagerMock, DepartmentsController sut) { // Fixture setup // Exercise system sut.Get(); // Verify outcome departmentManagerMock.Verify(d => d.GetAllDepartments(), Times