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" />
<PackageReference Include="TestingCommons.Core" />
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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#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
#tool nuget:?package=TestingCommons.Core&version=1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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 purposesStripTime(DateTime)- Removes time component, keeping only the dateParseDateTimeWithFormat(string, string)- Parses DateTime strings with custom formatsShiftTo1StDayOfNextMonth(DateTime)- Moves date to the first day of the next monthShiftTo1StDayOfCurrentMonth(DateTime)- Moves date to the first day of current monthShiftToLastDayOfCurrentMonth(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
IDateTimeProviderfor 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 | Versions 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.