public void It_stops_iterating_through_added_resolvers_when_one_returns_nonnull()
        {
            var compositeCommandResolver = new CompositeCommandResolver();

            var resolverCalls = new List<int>();

            var mockResolver1 = new Mock<ICommandResolver>();
            mockResolver1.Setup(r => r
                .Resolve(It.IsAny<CommandResolverArguments>()))
                .Returns(new CommandSpec(null, null, default(CommandResolutionStrategy)))
                .Callback(() => resolverCalls.Add(1));

            var mockResolver2 = new Mock<ICommandResolver>();
            mockResolver2.Setup(r => r
                .Resolve(It.IsAny<CommandResolverArguments>()))
                .Returns(default(CommandSpec))
                .Callback(() => resolverCalls.Add(2));

            compositeCommandResolver.AddCommandResolver(mockResolver1.Object);
            compositeCommandResolver.AddCommandResolver(mockResolver2.Object);

            compositeCommandResolver.Resolve(default(CommandResolverArguments));

            resolverCalls.Should()
                .HaveCount(1)
                .And
                .ContainInOrder(new [] {1});

        }
        public void It_iterates_through_all_added_resolvers_in_order_when_they_return_null()
        {
            var compositeCommandResolver = new CompositeCommandResolver();

            var resolverCalls = new List<int>();

            var mockResolver1 = new Mock<ICommandResolver>();
            mockResolver1.Setup(r => r
                .Resolve(It.IsAny<CommandResolverArguments>()))
                .Returns(default(CommandSpec))
                .Callback(() => resolverCalls.Add(1));

            var mockResolver2 = new Mock<ICommandResolver>();
            mockResolver2.Setup(r => r
                .Resolve(It.IsAny<CommandResolverArguments>()))
                .Returns(default(CommandSpec))
                .Callback(() => resolverCalls.Add(2));

            compositeCommandResolver.AddCommandResolver(mockResolver1.Object);
            compositeCommandResolver.AddCommandResolver(mockResolver2.Object);

            compositeCommandResolver.Resolve(default(CommandResolverArguments));

            resolverCalls.Should()
                .HaveCount(2)
                .And
                .ContainInOrder(new [] {1, 2});

        }
Esempio n. 3
0
        public static CompositeCommandResolver CreatePathCommandResolverPolicy(
            IEnvironmentProvider environment,
            IPlatformCommandSpecFactory platformCommandSpecFactory)
        {
            var compositeCommandResolver = new CompositeCommandResolver();

            compositeCommandResolver.AddCommandResolver(
                new PathCommandResolver(environment, platformCommandSpecFactory));

            return(compositeCommandResolver);
        }
Esempio n. 4
0
        public static CompositeCommandResolver CreateScriptCommandResolver(
            IEnvironmentProvider environment,
            IPlatformCommandSpecFactory platformCommandSpecFactory)
        {
            var compositeCommandResolver = new CompositeCommandResolver();

            compositeCommandResolver.AddCommandResolver(new RootedCommandResolver());
            compositeCommandResolver.AddCommandResolver(new ProjectPathCommandResolver(environment, platformCommandSpecFactory));
            compositeCommandResolver.AddCommandResolver(new AppBaseCommandResolver(environment, platformCommandSpecFactory));
            compositeCommandResolver.AddCommandResolver(new PathCommandResolver(environment, platformCommandSpecFactory));

            return(compositeCommandResolver);
        }
Esempio n. 5
0
        public static CompositeCommandResolver CreateScriptCommandResolver(
            IEnvironmentProvider environment,
            IPlatformCommandSpecFactory platformCommandSpecFactory)
        {
            var compositeCommandResolver = new CompositeCommandResolver();

            compositeCommandResolver.AddCommandResolver(new RootedCommandResolver());
            compositeCommandResolver.AddCommandResolver(new ProjectPathCommandResolver(environment, platformCommandSpecFactory));
            compositeCommandResolver.AddCommandResolver(new AppBaseCommandResolver(environment, platformCommandSpecFactory));
            compositeCommandResolver.AddCommandResolver(new PathCommandResolver(environment, platformCommandSpecFactory));
        
            return compositeCommandResolver;
        }
        public static CompositeCommandResolver CreateDefaultCommandResolver(
            IEnvironmentProvider environment,
            IPackagedCommandSpecFactory packagedCommandSpecFactory,
            IPlatformCommandSpecFactory platformCommandSpecFactory)
        {
            var compositeCommandResolver = new CompositeCommandResolver();

            compositeCommandResolver.AddCommandResolver(new MuxerCommandResolver());
            compositeCommandResolver.AddCommandResolver(new RootedCommandResolver());
            compositeCommandResolver.AddCommandResolver(new ProjectToolsCommandResolver(packagedCommandSpecFactory));
            compositeCommandResolver.AddCommandResolver(new AppBaseDllCommandResolver());
            compositeCommandResolver.AddCommandResolver(new AppBaseCommandResolver(environment, platformCommandSpecFactory));
            compositeCommandResolver.AddCommandResolver(new PathCommandResolver(environment, platformCommandSpecFactory));

            return compositeCommandResolver;
        }
        public static CompositeCommandResolver CreateDefaultCommandResolver(
            IEnvironmentProvider environment,
            IPackagedCommandSpecFactory packagedCommandSpecFactory,
            IPlatformCommandSpecFactory platformCommandSpecFactory)
        {
            var compositeCommandResolver = new CompositeCommandResolver();

            compositeCommandResolver.AddCommandResolver(new MuxerCommandResolver());
            compositeCommandResolver.AddCommandResolver(new RootedCommandResolver());
            compositeCommandResolver.AddCommandResolver(new ProjectToolsCommandResolver(packagedCommandSpecFactory));
            compositeCommandResolver.AddCommandResolver(new AppBaseDllCommandResolver());
            compositeCommandResolver.AddCommandResolver(new AppBaseCommandResolver(environment, platformCommandSpecFactory));
            compositeCommandResolver.AddCommandResolver(new PathCommandResolver(environment, platformCommandSpecFactory));

            return(compositeCommandResolver);
        }