Skip to main content
net8.0.NETStandard2.0

Expectations for the file and time system from Chronology.Abstractions.

Published
Dec 29, 2024
1y ago
Total Downloads
42.9K
42,895

Install

dotnet add package aweXpect.Chronology --version 0.2.1
ProductVersions
.NET
net8.0
.NET Standard
netstandard2.0

README

aweXpect.Chronology

Changelog Nuget Coverage Mutation testing badge

Extension methods for creating a TimeSpan or DateTime that reads more natural.

TimeSpan

Add the following extension methods on int and double that allow creating a TimeSpan:

  • .Milliseconds()
  • .Seconds()
  • .Minutes()
  • .Hours()
  • .Days()
// ↓ Using traditional creation of TimeSpan
TimeSpan timeout = TimeSpan.FromSeconds(10);
TimeSpan timeout = 10.Seconds();
// ↑ Using the extension methods from this library

It is also possible to combine multiple extension methods:

TimeSpan timeout = 1.Minutes(30.Seconds());

DateTime

Add extension methods on int for each month that allow creating a DateTime:

// ↓ Using traditional creation of DateTime
DateTime time = new DateTime(2024, 12, 24);
DateTime time = 24.December(2024);
// ↑ Using the extension methods from this library

It is also possible to specify a time:

DateTime time = 24.December(2024).At(18, 30);

It is also possible combine this with the TimeSpan extensions:

DateTime time = 3.Hours().Before(25.December(2024));

Changes from Previous Version

v0.2.0v0.2.1
Removed Dependencies
aweXpect.Core(.NETStandard2.0)

Adoption Assessment

A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.

Compatibility metadata lists 2 target frameworks; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.