Esempio n. 1
0
        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();
        }
Esempio n. 2
0
 //
 // +-------------+       +-------------+
 // | 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();
 }
Esempio n. 4
0
        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();
        }
Esempio n. 5
0
        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();
        }
Esempio n. 6
0
 public void ValidateInvalidSolution()
 {
     Assert.Throws <FileNotFoundException>(() => Layers.Configure().Validate("invalid.sln").Assert());
 }