forked from TNG/ArchUnitNET
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArchRuleAssert.cs
29 lines (27 loc) · 1.03 KB
/
ArchRuleAssert.cs
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
// Copyright 2019 Florian Gather <florian.gather@tngtech.com>
// Copyright 2019 Paula Ruiz <paularuiz22@gmail.com>
// Copyright 2019 Fritz Brandhuber <fritz.brandhuber@tngtech.com>
//
// SPDX-License-Identifier: Apache-2.0
using ArchUnitNET.Domain;
using ArchUnitNET.Fluent;
// ReSharper disable once CheckNamespace
namespace ArchUnitNET.xUnit
{
public static class ArchRuleAssert
{
/// <summary>
/// Verifies that the architecture meets the criteria of the archrule.
/// </summary>
/// <param name="architecture">The architecture to be tested</param>
/// <param name="archRule">The rule to test the architecture with</param>
/// <exception cref="FailedArchRuleException">Thrown if the rule is violated</exception>
public static void CheckRule(Architecture architecture, IArchRule archRule)
{
if (!archRule.HasNoViolations(architecture))
{
throw new FailedArchRuleException(architecture, archRule);
}
}
}
}