Created
October 26, 2021 18:37
-
-
Save eramax/ee6e6bbe50db44425b2bafe54a0bbd73 to your computer and use it in GitHub Desktop.
NetArchTests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using NetArchTest.Rules; | |
using WebApi2.Services; | |
using Xunit; | |
/// <summary> | |
/// NetArchTest | |
/// https://github.com/BenMorris/NetArchTest | |
/// </summary> | |
namespace NetArch | |
{ | |
public class directly_reference | |
{ | |
[Fact] | |
public void Classes_in_presentation_should_not_directly_reference_repositories() | |
{ | |
// Classes in the presentation should not directly reference repositories | |
var result = Types.InCurrentDomain() | |
.That() | |
.ResideInNamespace("WebApi2.Controllers") | |
.ShouldNot() | |
.HaveDependencyOn("DataLib") | |
.GetResult() | |
.IsSuccessful; | |
} | |
[Fact] | |
public void All_the_service_classes_should_be_sealed() | |
{ | |
// All the service classes should be sealed | |
var result = Types.InCurrentDomain() | |
.That().ImplementInterface(typeof(IUserService)) | |
.Should().BeSealed() | |
.GetResult() | |
.IsSuccessful; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment