-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
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,28 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
|
||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" /> | ||
<PackageReference Include="xunit" Version="2.4.1" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
<PackageReference Include="coverlet.collector" Version="3.1.2"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\ImapCleanup\ImapCleanup.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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,70 @@ | ||
using ImapCleanup.Extensions; | ||
|
||
namespace ImapCleanup.Tests | ||
{ | ||
public class TimeSpanExtensionsTests | ||
{ | ||
[Fact] | ||
public void When_in_timeframe_true_is_returned() | ||
{ | ||
var sut = TimeSpan.Parse("13:37"); | ||
Assert.True(sut.IsInTimeFrame(new TimeSpan(12, 00, 00), new TimeSpan(14,00,00))); | ||
} | ||
|
||
[Fact] | ||
public void When_before_timeframe_false_is_returned() | ||
{ | ||
var sut = TimeSpan.Parse("11:37"); | ||
Assert.False(sut.IsInTimeFrame(new TimeSpan(12, 00, 00), new TimeSpan(14, 00, 00))); | ||
} | ||
|
||
[Fact] | ||
public void When_after_timeframe_false_is_returned() | ||
{ | ||
var sut = TimeSpan.Parse("11:37"); | ||
Assert.False(sut.IsInTimeFrame(new TimeSpan(12, 00, 00), new TimeSpan(14, 00, 00))); | ||
} | ||
|
||
[Fact] | ||
public void When_on_fromTime_true_is_returned() | ||
{ | ||
var sut = TimeSpan.Parse("12:00"); | ||
Assert.True(sut.IsInTimeFrame(new TimeSpan(12, 00, 00), new TimeSpan(14, 00, 00))); | ||
} | ||
|
||
[Fact] | ||
public void When_on_toTime_true_is_returned() | ||
{ | ||
var sut = TimeSpan.Parse("14:00"); | ||
Assert.True(sut.IsInTimeFrame(new TimeSpan(12, 00, 00), new TimeSpan(14, 00, 00))); | ||
} | ||
|
||
[Fact] | ||
public void When_timeframe_spans_days_and_in_timeframe_true_is_returned() | ||
{ | ||
var sut = TimeSpan.Parse("23:00"); | ||
Assert.True(sut.IsInTimeFrame(new TimeSpan(22, 00, 00), new TimeSpan(6, 00, 00))); | ||
} | ||
|
||
[Fact] | ||
public void When_timeframe_spans_days_and_in_timeframe_next_day_true_is_returned() | ||
{ | ||
var sut = TimeSpan.Parse("5:00"); | ||
Assert.True(sut.IsInTimeFrame(new TimeSpan(22, 00, 00), new TimeSpan(6, 00, 00))); | ||
} | ||
|
||
[Fact] | ||
public void When_timeframe_spans_days_and_before_timeframe_false_is_returned() | ||
{ | ||
var sut = TimeSpan.Parse("21:00"); | ||
Assert.False(sut.IsInTimeFrame(new TimeSpan(22, 00, 00), new TimeSpan(6, 00, 00))); | ||
} | ||
|
||
[Fact] | ||
public void When_timeframe_spans_days_and_after_timeframe_false_is_returned() | ||
{ | ||
var sut = TimeSpan.Parse("6:01"); | ||
Assert.False(sut.IsInTimeFrame(new TimeSpan(22, 00, 00), new TimeSpan(6, 00, 00))); | ||
} | ||
} | ||
} |
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 @@ | ||
global using Xunit; |
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