-
Notifications
You must be signed in to change notification settings - Fork 516
Expand file tree
/
Copy pathBusinessRuleValidatorTests.cs
More file actions
37 lines (30 loc) · 958 Bytes
/
BusinessRuleValidatorTests.cs
File metadata and controls
37 lines (30 loc) · 958 Bytes
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
37
namespace EvolutionaryArchitecture.Fitnet.Common.Core.UnitTests.BusinessRulesEngine;
using BusinessRules;
public sealed class BusinessRuleValidatorTests
{
[Fact]
internal void Given_concrete_business_rule_which_is_met_Then_validation_should_pass()
{
// Arrange
// Act
static void FakeBusinessRule()
{
BusinessRuleValidator.Validate(new FakeBusinessRule(20));
}
// Assert
Should.NotThrow(FakeBusinessRule);
}
[Fact]
internal void Given_concrete_business_rule_which_is_not_met_Then_validation_should_throw()
{
// Arrange
// Act
static void NotMetRuleAction()
{
BusinessRuleValidator.Validate(new FakeBusinessRule(1));
}
// Assert
var exception = Should.Throw<BusinessRuleValidationException>(NotMetRuleAction);
exception.Message.ShouldBe("Fake business rule was not met");
}
}