forked from TNG/ArchUnitNET
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ArchRuleAssert.cs
29 lines (27 loc) · 1016 Bytes
/
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 <[email protected]>
// Copyright 2019 Paula Ruiz <[email protected]>
// Copyright 2019 Fritz Brandhuber <[email protected]>
//
// SPDX-License-Identifier: Apache-2.0
using ArchUnitNET.Domain;
using ArchUnitNET.Fluent;
using ArchUnitNET.Fluent.Extensions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace ArchUnitNET.MSTestV2
{
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>
public static void FulfilsRule(Architecture architecture, IArchRule archRule)
{
if (!archRule.HasNoViolations(architecture))
{
Assert.Fail(archRule.Evaluate(architecture).ToErrorMessage());
}
}
}
}