xunit

junit test results in tfs

人盡茶涼 提交于 2019-12-11 04:07:21
问题 How to make TFS 2010 show junit test results, that were generated by third-party tool? If it can't, probably, there is a way to convert junit report to xunit/nunit/mstest report. It would be also great! Thanks. 回答1: In order to publish Junit tests during TFS-Build you can make use of TFS Build Extension Power Tool. In there you can find a set of XSLT transforms from JUnit output into TRX. Employing TFS-Build to upload TRX should from then be possible. 来源: https://stackoverflow.com/questions

xUnit with Jenkins: how to display colors in the Build Console Output?

早过忘川 提交于 2019-12-11 02:59:35
问题 I successfully setup CasperJS test suite exporting to an xUnit XML file that way: $ casperjs test googletesting.js --xunit=log.xml I managed to automate these tests through Jenkins thanks to the xUnit Plugin. I even managed to setup emails notifications when a build fails thanks to [Mail Watcher Plugin][3] which is great ! The only problem is the format of the output, it's a bit messy. In the build console output and in my email notifications I see the following: [37;46;1mTest file: tests.js

How to write unit test for custom model binder in ASP.net core

♀尐吖头ヾ 提交于 2019-12-11 02:48:41
问题 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 have to write test. public class JourneyTypesModelBinder : IModelBinder { public Task BindModelAsync(ModelBindingContext bindingContext) { bool IsSingleWay = Convert.ToBoolean((bindingContext.ValueProvider.GetValue("IsSingleWay")).FirstValue); bool IsMultiWay = Convert.ToBoolean((bindingContext

How to run F# Silverlight Library project holding xUnit.net Contrib based unit tests?

非 Y 不嫁゛ 提交于 2019-12-11 02:13:37
问题 I am unaware of any project templates for F# Silverlight 4 unit tests (I searched Online for templates through Add Project), so I am using the standard F# Silverlight Library project to hold my unit tests (which are just file links to the main unit test project files). I am using xUnit.net Contrib for Silverlight. So everything compiles but I don't know how to run the tests! TestDriven.NET works for my normal unit test project but not this Silverlight unit test project. I tried to use the

IOC injection of IServerSideEvents

假装没事ソ 提交于 2019-12-10 22:59:21
问题 I am writing unit tests for my IOC. One of my interfaces injects IServerEvents. I am including events via: ServerEventsFeature serverEventsFeature = new ServerEventsFeature() { LimitToAuthenticatedUsers = false, NotifyChannelOfSubscriptions = false, OnConnect = (eventSubscription, dictionary) => { }, OnSubscribe = (eventSubscription) => { } }; However, container.Resolve gives the following error when debugging (Not through unit tests) : 'container.Resolve<IServerEvents>()' threw an exception

Unit test failing only when run on the build server

﹥>﹥吖頭↗ 提交于 2019-12-10 21:04:06
问题 To aid unit-testing we have wrapped up the DateTime class in a delegate so that DateTime.Now can be overridden in a unit-test. public static class SystemTime { #region Static Fields public static Func<DateTime> Now = () => DateTime.Now; #endregion } Here is an example of its use in an xunit unit-test: [Fact] public void it_should_update_the_last_accessed_timestamp_on_an_entry() { // Arrange var service = this.CreateClassUnderTest(); var expectedTimestamp = SystemTime.Now(); SystemTime.Now = (

Autofixture: How to express the following code declaratively?

China☆狼群 提交于 2019-12-10 19:18:48
问题 I am having trouble expressing the following code in a declarative fashion: [Theory] [InlineData(@"-o=C:\Temp\someFile -p=1")] [InlineData(@"-p=1 -o=C:\Temp\someFile")] public void ParseMissingParameterShouldReturnCorrectResult( string argsString ) { ..... var fixture = new Fixture(); fixture.Register<IFoo>(fixture.Create<Foo>); fixture.Register<IBar>(fixture.Create<Bar>); var sut = fixture.Create<SomeClass>(); ..... } In my production code, I've got something like: new SomeClass(new Foo(new

C# xUnit Test listeners

给你一囗甜甜゛ 提交于 2019-12-10 17:40:53
问题 I'm building a selenium test framework based on .Net Core and the team decided to go with xUnit. All's well and good everything has been going ok but for a while now, we've been trying to replicate the functionality of Java TestNG listeners without much luck. I've been digging around the xunit git repo and found a few instances where some interfaces such ITestListener have been used. After digging deeper, I found that these listeners are from a package called TestDriven.Framework and I wanted

Passing discriminated unions to InlineData attributes

爷,独闯天下 提交于 2019-12-10 17:37:16
问题 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.Extensions' attribute InlineData to stack all test cases on one another: [<Theory>] [<InlineData("1 +1 ", Binary(Literal(Number(1.0)), Add, Literal(Number(1.0))))>] ... let ``parsed string matches the expected result`` () = However, compiler complains that the second argument is not a literal

How to mock UserManager<IdentityUser>

霸气de小男生 提交于 2019-12-10 17:13:04
问题 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 understand the process i figure i can start refactoring my project for adding testing. web application So i created a web application and added default user identity to it. This gave me a start up looking like this public void ConfigureServices(IServiceCollection services) { services.Configure