2021-06-11 19:55:34 +00:00
|
|
|
|
using System;
|
2021-06-21 14:46:44 +00:00
|
|
|
|
using Retroactiune.Core.DataAnnotations;
|
2021-06-11 19:55:34 +00:00
|
|
|
|
using Xunit;
|
|
|
|
|
|
2021-06-21 14:46:44 +00:00
|
|
|
|
namespace Retroactiune.Tests.Retroactiune.Core.DataAnnotations
|
2021-06-11 19:55:34 +00:00
|
|
|
|
{
|
|
|
|
|
public class TestDatetimeNotInThePast
|
|
|
|
|
{
|
|
|
|
|
[Fact]
|
|
|
|
|
public void Test_DatetimeNotInThePast_NullDate()
|
|
|
|
|
{
|
|
|
|
|
var test = new DatetimeNotInThePast();
|
|
|
|
|
Assert.True(test.IsValid(null));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void Test_DatetimeNotInThePast_FutureDate()
|
|
|
|
|
{
|
|
|
|
|
var test = new DatetimeNotInThePast();
|
|
|
|
|
var futureDate = DateTime.UtcNow.AddDays(1);
|
|
|
|
|
Assert.True(test.IsValid(futureDate));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void Test_DatetimeNotInThePast_PastDate()
|
|
|
|
|
{
|
|
|
|
|
var test = new DatetimeNotInThePast();
|
|
|
|
|
var pastDate = DateTime.UtcNow.Subtract(new TimeSpan(1));
|
|
|
|
|
Assert.False(test.IsValid(pastDate));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|