An ordered collection of available RepositoryPattern patterns, with the ability to find the best match for a given context.
Наследование: IProjectParameters
        public void NoMatchBecauseOfFileSystem()
        {
            var access = new Mock<IFileSystemRepositoryAccess>();
            var context = CreateContext();

            var patterns = new RepositoryPatternCollection(access.Object);
            patterns.AddPattern(new RepositoryPattern("pattern1"));
            patterns.AddPattern(new RepositoryPattern("pattern2"));
            patterns.AddPattern(new RepositoryPattern("pattern3"));

            var resolution = patterns.Resolve(context.Object);

            resolution.Should().BeNull();
        }
        public void NoMatchBecauseOfPatternResolution()
        {
            var access = new Mock<IFileSystemRepositoryAccess>();
            var context = CreateContext();

            access.Setup(a => a.Exists(It.IsAny<string>())).Returns(true);

            var patterns = new RepositoryPatternCollection(access.Object);
            patterns.AddPattern(new RepositoryPattern("pattern1.%VERSION"));
            patterns.AddPattern(new RepositoryPattern("pattern2.%VERSION"));
            patterns.AddPattern(new RepositoryPattern("pattern3.%VERSION"));

            var resolution = patterns.Resolve(context.Object);

            resolution.Should().BeNull();
        }
        public void FirstMatchChoosen()
        {
            var access = new Mock<IFileSystemRepositoryAccess>();
            var context = CreateContext();

            access.Setup(a => a.Exists(It.IsAny<string>())).Returns(true);

            var patterns = new RepositoryPatternCollection(access.Object);
            patterns.AddPattern(new RepositoryPattern("pattern1"));
            patterns.AddPattern(new RepositoryPattern("pattern2"));
            patterns.AddPattern(new RepositoryPattern("pattern3"));

            var resolution = patterns.Resolve(context.Object);

            resolution.Should().Be("pattern1");
        }
        public void MatchUsesFileSystemChecks()
        {
            var access = new Mock<IFileSystemRepositoryAccess>();
            var context = CreateContext();

            access.Setup(a => a.Exists("pattern1")).Returns(false);
            access.Setup(a => a.Exists("pattern2")).Returns(true);
            access.Setup(a => a.Exists("pattern3")).Returns(false);

            var patterns = new RepositoryPatternCollection(access.Object);
            patterns.AddPattern(new RepositoryPattern("pattern1"));
            patterns.AddPattern(new RepositoryPattern("pattern2"));
            patterns.AddPattern(new RepositoryPattern("pattern3"));

            var resolution = patterns.Resolve(context.Object);

            resolution.Should().Be("pattern2");
        }