Angular (Typescript) Unit Testing - ASP.Net Core MVC SPA - unit-testing

I am developing a project which started life as an ASP.Net Core MVC SPA Template in Visual Studio 2015. I used the Visual Studio Karma Test Adapter with no problems for my Angular (Typescript) unit testing, but no matter what I tried I could not get NUnit to recognise my C# unit tests for the Web API and early Domain Model code. I tried to add a separate Test Project with no success and I also created unit test files within the same, single, project with no success.
At some point I knew I should migrate the code to Visual Studio 2017, as I feel that the new IDE will prove to be beneficial as the project develops, so I thought I would do it now and see if it solves my unit testing problems. Visual Studio's migration process didn't go well so I decided to start from scratch again.
I ran dotnet new angular to create a clean solution which I opened in VS 2017. It appears that the Visual Studio Karma Test Adapter does not work with VS 2017 yet, so for the Typescript (Jasmine) testing that left me with Chutzpah. No matter what I try I cannot write the simplest of Jasmine tests and have the Visual Studio Test Explorer recognise it (let alone run the test). I haven't even begun to look at the C# Unit Testing yet.
Can anyone else get a Jasmine Unit Test to be recognised and run in the VS Test Explorer from a clean dotnet new angular solution, I would be very grateful for some advise.

Related

UWP Unit Tests Don't Show Up in Rider

I have a solution with two unit testing projects. One is for .NET and the other is for UWP. The .NET Framework and .NET Core tests show up in Rider but the UWP tests don't show up. They show up in Visual Studio. You can see the project here. It appears that dotCover is supposed to support UWP. I assume that Rider uses the same engine. Also, I opened dotCover and found my app unit testing app among the packages but it doesn't pick up any of the tests either. I'm using MS Test but can switch if need be.
This is what I see in dotCover:
Does Rider support UWP for unit testing? If not, can I do this with dotCover? What am I doing wrong?
Right now, even ReSharper does not support discovering UWP tests in Visual Studio 2019 due to a lack of API. That's why it does not work in Rider as well.
However, we've implemented our own test runner to run UWP tests https://youtrack.jetbrains.com/issue/RSRP-473827, and it will be available in upcoming releases in both ReSharper and Rider.

Unit Testing Typescript In Visual Studio for Angular 2 development

I am new to angular2. Hence we are writing code in Typescript for our website. We are using Visual studio 2013 for the development. Now we need to write Unit Test cases for the Typescript code we have written.
Can someone please share a step by step example on how to configure typescript unit testing in visual studio. And whether should we write unit test cases for typescript in typescript, or we should write unit test cases for typescript in Javascript.
Thanks in advance.
Have you seen this: https://github.com/Steve-Fenton/tsUnit
"tsUnit is a unit testing framework for TypeScript, written in TypeScript. It allows you to encapsulate your test functions in classes and modules."
While this does not provide "step-by-step" directions ... it could be a step in the right direction!

c++ unit test/mock framework integrated into visual studio 2012

I want to use unit tests in VS 2012 in c++. VS allows to write unit tests, run them and see the output in test explorer window. Unfortunately it seems that VS lacks a mock framework. Do You know how to integrate for example Google Test/Mock framework into VS, so that I can still see the test results in test explorer window?

Weird problem with Visual Studio - when I change the name of a unit test, it does not update

I've run into a weird problem with Unit Tests in Visual Studio 2010 that I can't solve (is this a bug in Visual Studio?).
If I edit the name of a unit test, it is not updating in the "Test List Editor" view. If I add a unit test using the normal method, it doesn't add it to the list of unit tests.
Any ideas on what might be possibly be causing this, and perhaps brainstorming some method to redo my Unit Test project to fix this problem?
Found the problem: I have ReSharper installed, and it unexpectedly took over the default unit testing framework provided by Visual Studio 2010, when an auto version upgrade took place. I am currently running the unit tests using the ReSharper unit testing plugin, and everything works fine. This is not to say that it's necessarily ReSharper's fault, I did opt in to use the enhanced unit testing framework when I installed it a month ago (and I can opt out by switching it off in options).

How to avoid breaking build when committing Visual Studio Unit Tests in CruiseControl.Net

I'm having a problem when a project is committed to SVN, which in turn is automatically picked up by our newly set-up CruiseControl.NET server, the UnitTests are failing.
The unit tests are written in the default Visual Studio Unit test framework - which is the problem. I spot that nUnit appears to be recommended as a good alternative. However, that doesn't change my current predicament - I would like a working build without having to re-write every single one of my Unit Tests in the nUnit Framework (Would converting a MS Unit Test project take any considerable amount of time - it looks the same to me?)
What is the best way for me to proceed now? We are unable to install Visual Studio on the box and our IT department won't allow us access to go fiddling in the registry.
I am not sure how to run unit tests without Visual Studio, but I had moved to NUnit from MSTests and its reasonably easy - as long as you don't use the test context from MSTest(can't remember the real name), all you have to do is to rename the tags [TestClass] -> [TestFixture], etc (there is always 1-1 mapping) and change the usings. Running NUnit tests on the build machine is trivial.
Also you can try to convince your company to buy you a copy of Resharper (preferred), or TestDriven.NET - so you can easily run NUnit tests from Visual Studio.