public void ReferenceAnything() { // // +-------------+ // | Shared.Core | // +-------------+ // ^ // +----------*----------+ // | // +-------------+ // | App.Test | // +-------------+ // var sharedCore = CreateProject("Shared.Core"); var appTest = CreateProject("App.Test", sharedCore.Id); var solution = new Solution(new Project[] { sharedCore, appTest }); Layers.Configure() .Layer("Shared").HasNoReferences() .Layer("App").References("Shared") .Component("Core").HasNoReferences() .Component("Test").ReferencesAnything() .Validate(solution) .AssertThrowsFirst(); }
// // +-------------+ +-------------+ // | Shared.Core | <---- | Shared.Host | // +-------------+ +-------------+ // ^ ^ ^ // | +-------------+ | // | | | // +-------------+ +-------------+ // | App.Core | <---- | App.Host | // +-------------+ +-------------+ // public IConfiguration GetDefaultLayout() { return(Layers.Configure() .Layer("Shared").HasNoReferences() .Layer("App").References("Shared") .Component("Core").HasNoReferences() .Component("Host").References("Core")); }
public void ValidateSolution() { Layers.Configure(Expression.Type.RegularExpression) .Layer(@"BoundedLayers.*").HasNoReferences() .Component(@"BoundedLayers").HasNoReferences() .Component(@".*\.Test").References(@"BoundedLayers") .Validate(@"../../../BoundedLayers.sln") .Assert(); }
public void RegexExpressions() { var sharedCore = CreateProject("Shared"); var sharedHost = CreateProject("Shared.Host", sharedCore.Id); Layers.Configure(Expression.Type.RegularExpression) .Layer(@"Shared.*").HasNoReferences() .Component(@"Shared").HasNoReferences() .Component(@".*\.Host").References(@"Shared") .Validate(new Solution(new Project[] { sharedCore, sharedHost })) .AssertThrowsFirst(); }
public void RegexPrefixExpressions() { var sharedCore = CreateProject("Shared"); var sharedHost = CreateProject("App.Host", sharedCore.Id); Layers.Configure() .Layer("Shared").HasNoReferences() .Layer("App").References("r:Sh.*") .Component("Shared").HasNoReferences() .Component("Host").References("Shared") .Validate(new Solution(new Project[] { sharedCore, sharedHost })) .AssertThrowsFirst(); }
public void ValidateInvalidSolution() { Assert.Throws <FileNotFoundException>(() => Layers.Configure().Validate("invalid.sln").Assert()); }