-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Add a test for TimeSpan properties
- Loading branch information
Laurynas Lazauskas
committed
Jul 25, 2023
1 parent
75e74e5
commit 41fae51
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
test/Extensionsions.Configuration.Object.UnitTests/TimeSpanTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using AutoFixture.Xunit2; | ||
using FluentAssertions; | ||
using Microsoft.Extensions.Configuration; | ||
using System; | ||
using Xunit; | ||
|
||
namespace Extensions.Configuration.Object.UnitTests; | ||
|
||
public class TimeSpanTest | ||
{ | ||
[Theory, AutoData] | ||
public void AddObject_WithTimeSpan_ShouldLoadFieldsIntoConfiguration(TimeSpan expected) | ||
{ | ||
var configuration = new ConfigurationBuilder() | ||
.AddObject(new { MyTimeSpan = expected }) | ||
.Build(); | ||
|
||
configuration[$"MyTimeSpan"].Should().Be(expected.ToString()); | ||
} | ||
} |