TestingCommons.Core 1.0.3

dotnet add package TestingCommons.Core --version 1.0.3
                    
NuGet\Install-Package TestingCommons.Core -Version 1.0.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TestingCommons.Core" Version="1.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TestingCommons.Core" Version="1.0.3" />
                    
Directory.Packages.props
<PackageReference Include="TestingCommons.Core" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add TestingCommons.Core --version 1.0.3
                    
#r "nuget: TestingCommons.Core, 1.0.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package TestingCommons.Core@1.0.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=TestingCommons.Core&version=1.0.3
                    
Install as a Cake Addin
#tool nuget:?package=TestingCommons.Core&version=1.0.3
                    
Install as a Cake Tool

TestingCommons.Core

The Core project provides fundamental utilities, extensions, and abstractions used across testing scenarios. It includes common operations, date/time utilities, number extensions, and testable date-time providers.

Key Components

Utilities (Utils namespace)

CommonOperations

  • GetMaskedIban(string iban) - Masks IBAN numbers for secure display, showing only the last 4 characters

DateTimeExtensions

  • StripMilliseconds(DateTime) - Removes milliseconds from DateTime for comparison purposes
  • StripTime(DateTime) - Removes time component, keeping only the date
  • ParseDateTimeWithFormat(string, string) - Parses DateTime strings with custom formats
  • ShiftTo1StDayOfNextMonth(DateTime) - Moves date to the first day of the next month
  • ShiftTo1StDayOfCurrentMonth(DateTime) - Moves date to the first day of current month
  • ShiftToLastDayOfCurrentMonth(DateTime) - Moves date to the last day of current month

NumberExtensions

  • GetNegativeFromPositive(int/decimal/double) - Converts positive numbers to negative (leaves negatives unchanged)

DateTime Provider

UtcDateTimeProvider

  • Implements IDateTimeProvider for testable date/time operations
  • Always returns UTC times to ensure consistency across time zones
  • Properties: Now (DateTime.UtcNow), NowOffset (DateTimeOffset.UtcNow)

Usage Examples

// IBAN Masking
string iban = "DE1234567890123456";
string masked = CommonOperations.GetMaskedIban(iban);
// Result: "**************3456"

// DateTime Extensions
DateTime now = DateTime.Now;
DateTime dateOnly = now.StripTime();           // 2025-08-09 00:00:00
DateTime noMillis = now.StripMilliseconds();   // 2025-08-09 14:30:45
DateTime firstDay = now.ShiftTo1StDayOfCurrentMonth(); // 2025-08-01 14:30:45

// Number Extensions
decimal amount = 100.50m;
decimal negative = amount.GetNegativeFromPositive(); // -100.50

// Testable DateTime Provider
IDateTimeProvider dateProvider = new UtcDateTimeProvider();
DateTime utcNow = dateProvider.Now;
DateTimeOffset utcNowOffset = dateProvider.NowOffset;

Key Features

  • IBAN Security: Safe display of sensitive financial data
  • Date Manipulation: Common date operations for testing scenarios
  • Number Utilities: Consistent handling of positive/negative conversions
  • Testable Time: Abstracted DateTime provider for unit testing
  • UTC Consistency: Ensures all times are in UTC to avoid timezone issues
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on TestingCommons.Core:

Package Downloads
TestingCommons.Azure

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.3 223 8/9/2025
1.0.2 218 8/9/2025
1.0.1 199 8/9/2025
1.0.0 176 6/27/2025
0.1.1 191 8/9/2025