-
Notifications
You must be signed in to change notification settings - Fork 516
Expand file tree
/
Copy pathContractCanOnlyBeSignedWithin30DaysFromPreparationTests.cs
More file actions
36 lines (31 loc) · 1.57 KB
/
ContractCanOnlyBeSignedWithin30DaysFromPreparationTests.cs
File metadata and controls
36 lines (31 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
namespace EvolutionaryArchitecture.Fitnet.Contracts.Core.UnitTests.SignContract.BusinessRules;
using Common.Core.BusinessRules;
using Core.SignContract.BusinessRules;
public sealed class ContractCanOnlyBeSignedWithin30DaysFromPreparationTests
{
[Fact]
internal void Given_signed_at_date_which_is_more_than_30_days_from_prepared_at_date_Then_validation_should_throw()
{
// Arrange & Act & Assert
var exception = Should.Throw<BusinessRuleValidationException>(() =>
BusinessRuleValidator.Validate(
new ContractCanOnlyBeSignedWithin30DaysFromPreparation(DateTimeOffset.Now,
DateTimeOffset.Now.AddDays(31))));
exception.Message.ShouldBe(
"Contract can not be signed because more than 30 days have passed from the contract preparation");
}
[Fact]
internal void Given_signed_at_date_which_is_30_days_from_prepared_at_date_Then_validation_should_pass() =>
// Arrange & Act & Assert
Should.NotThrow(() =>
BusinessRuleValidator.Validate(
new ContractCanOnlyBeSignedWithin30DaysFromPreparation(DateTimeOffset.Now,
DateTimeOffset.Now.AddDays(30))));
[Fact]
internal void Given_signed_at_date_which_is_less_than_30_days_from_prepared_at_date_Then_validation_should_pass() =>
// Arrange & Act & Assert
Should.NotThrow(() =>
BusinessRuleValidator.Validate(
new ContractCanOnlyBeSignedWithin30DaysFromPreparation(DateTimeOffset.Now,
DateTimeOffset.Now.AddDays(29))));
}