Advanced Search
Search Results
80 total results found
C# Unit Tests with Async Task Signature
When writing unit tests, it’s good to standardize as much as possible.This includes the method signature for each test cases, such as this: // Test_1_1_1 Describe the test... [TestMethod] public async Task Test_1_1_1() { // Do some testing... ... ...
Unit Test Cheat Sheet
Here’s a list of elements for unit testing in Visual Studio using MSTest. Documentation for Visual Studio Testing is here: GitHub - microsoft/vstest-docs: Documentation for the Visual Studio Test Platform. Necessary Packages The following packages are neces...
C# Unit Test Template Classes
If you are using MSTest as your testing framework, and want to leverage the test functionality from OGA.Testing.Lib, here are the minimal classes and structure you will need. For a cheat-sheet on MSTest framework usage, see this: Unit Test Cheat Sheet Depend...
.NET Framework Unit Testing Issues
Since we have some libraries that still output to NET Framework targets, some workarounds are required because of some design choices that have been made in the MSTest library and Test Explorer. MSTest Project Styles (SDK vs Non-SDK) NOTE: This only applies ...
.NET iOS Runtime Limitations
Here’s some notes on the limitations imposed by IOS for Xamarin and MAUI applications. These apply to both Xamarin and MAUI apps written for iOS. Basically, the iOS kernel prevents any application from generating dynamic code at runtime. So, any usage of JI...
PostgreSQL DotNet DataType Mapping
Here’s a list of .NET datatypes, and how best to store each one. .NET Datatype PostGreSQL DataType datetime (UTC) timestamp without time zone Guid uuid float real double double precision ...
PostgreSQL Bulk Insert
Here’s a means to insert multiple records in a single insert call, which is about 40 times faster than performing an explicit insert for each row. We will leverage the BeginBinaryImport method on the database connection class of the NPGSQL library. To make t...
Missing AspNetCore Nuget Packages
There are several aspects of an ASP Net Core web API that cannot be placed in a class library without a little extra care. This is because Microsoft decided to remove “many of the core assemblies” from nuget packages for the ASPNetCore, when Net Core 3.0 was p...
VS Project Conditional Constants
When developing cross-platform libraries, you will have the need to enable and disable different parts of your source code based on what statements or functions work on each platform. For example: Processes are queried differently in Windows than linux.And, c...
.NET Core In-Memory Cache
Here is a working method for using the In-Memory cache. For a thread-safe cache update, see the example at the bottom. Assimilate this into a working project: In-Memory Caching in ASP.NET Core - Code Maze Understanding & Implementing Caching in ASP.NET C...
How To Add Release Notes to Nuget Package
These are the steps needed to include release notes in a Nuget package. These are taken from this article:Writing a NuGet package release notes in an outside of a .csproj file. Same article here:Writing a NuGet package release notes in an outside of a .csproj...
.NET How to Create and Publish Nuget Package
Taken from here: docs.microsoft.com-nuget/docs/quickstart/create-and-publish-a-package-using-the-dotnet-cli.md at main · NuGet/docs.microsoft.com-nuget Here is more content on additional properties for a nuget package: docs.microsoft.com-nuget/docs/referenc...
Nuget Package Reference
Here’s the golden reference for all things Nuget: docs.microsoft.com-nuget/docs at main · NuGet/docs.microsoft.com-nuget How to publish NuGet symbol packages using the new symbol package format '.snupkg' Non-Trivial Multi-Targeting with .NET Multi-targetin...
Code Signing Cert Setup
Each time you receive a new code signing certificate on a USB eToken, there are steps to perform and information to collect, so it can be utilized in an automated build pipeline. There is little comprehensive documentation available on the web, for how to eas...
HowTo: Create a New Cloud Service or Library
Current as of: 20250126 This list will be revised as more steps get automated. This is a working list of manual steps that cover the genesis to deployment of a new cloud service, library, or app. It includes steps to define, document, create, configure, aut...
NET Core Background Services
NOTE: Refer to this page for how to register and consume a background service: Consuming NET Core Background Service with DI General Lots of the ceremony of a background service has been wrapped up and tested, in this class: BackgroundService_Base NOTE: As ...
Getting Correct Scheme, Host, Port Behind a Proxy
When running an API behind a reverse proxy, such as NGINX, the service will not, by default, see the scheme and port of the incoming call. By default, the API service will see the scheme and port of the direct call to it, which will likely be http and some int...
How to Create IOptions Instance
It’s pretty standard for classes to require configuration in their constructors in the IOptions form.But, this doesn’t make testing very easy. Here’s a workaround for pushing an IOptions instance into a class constructor, that needs config. This example is f...
IServiceProvider vs IServiceScopeFactory
References: Net Core DI Truths Internet’s Claim of Anti-Patterns Contrary to what the internet says about service locator usage as anti-pattern, there will always be the need for logic to dynamically access services from DI.This is because the NET Core runti...
Net Core DI Truths
References: NET Core DI Best Practices Here’s a list of behaviors of the NET Core DI registry: All dynamic access to services (from DI) are requested through a service provider.This is what people call a service locator. For example:var foosvc = _servic...