Issue Unit refuses to dsicover or run my tests in an assembly. This is not the case where Unit produces an error message like “Unable to find test in assembly”. It simply doesn’t discover that I have tests. I right-click
Continue readingTag: unit-testing
[SOLVED] CMake file for integrated Visual Studio unit testing
Issue Visual Studio 2017 has integrated C++ unit testing (native, google test, ctest, etc.). How can I create a CMakeLists.txt file that will create a project like this that will use the integrated IDE testing, for example using either google
Continue reading[SOLVED] Visual Studio ~ Test project does not find namespace of tested project
Issue I have a C# ASP.NET Core Project that I want to write tests for. However, for some strange reason the test project does not find the namespaces (and thus also the classes) of the project that I want to
Continue reading[SOLVED] Can a C# MsTest project be converted to Microsoft.NET.Sdk project format?
Issue I’ve got a C# MsTest project that targets net48. I’ve change the project it tests to the newer style Microsoft.NET.Sdk csproj format and that went ok. Now I want to convert the unit test project too. I get errors
Continue reading[SOLVED] How to pass Guid.Empty into a parameterized unit test?
Issue I’m attempting to pass Guid.Empty into my unit test: [TestCase(null)] [TestCase(Guid.Empty)] public void When_AccountGuid_IsNullOrEmpty_AddError_Is_Invoked(Guid? accountGuid) { } However the compiler is complaining: An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute
Continue reading[SOLVED] Having to manually add a project reference to csproj file when creating Unit Tests
Issue I’m following this tutorial on how to create Unit Tests for my C# project. However when I’m attempting to import one project into another I get an error saying the type or namespace cannot be found. I was able
Continue reading[SOLVED] "No tests found to run" Xunit test not detected in Test explorer, Visual Studio 2022
Issue As you guys can see on the screenshot, i can run my Xunit test through cmd, however in Test Explorer no test was found. I have these packages from nuget: <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0-preview-20220726-02" /> <PackageReference Include="xunit" Version="2.4.2" /> <PackageReference
Continue reading[SOLVED] How can I write output from a unit test?
Issue Any call in my unit tests to either Debug.Write(line) or Console.Write(Line) simply gets skipped over while debugging and the output is never printed. Calls to these functions from within classes I’m using work fine. I understand that unit testing
Continue reading[SOLVED] Abstracting/Interfacing a class within a Nuget Package for Unit Testing
Issue So I have a Application that currrently uses the EAGetMail nuget package for scraping EmailServers. I am attempting to refactor my project and interface individual pieces for mocking in Unit Tests. My current issue is the classes in the
Continue reading[SOLVED] ExpectedException not catching exception, but I can catch it with try catch
Issue Any ideas on this one? I’m trying to write a unit test that will delete an item and confirm that item is no longer in a repository by trying to retrieve the item by its ID which should throw
Continue reading