Exemplo n.º 1
0
        public void TestGetDepsWithBranchSwitchToHugeConfig()
        {
            using (var env = new TestEnvironment())
            {
                var dir = env.WorkingDirectory.Path;

                env.CreateRepo("A", new Dictionary <string, DepsContent>
                {
                    { "full-build", new DepsContent(null, new List <Dep> {
                            new Dep("B@branch/client"), new Dep("Y")
                        }) }
                });
                env.CreateRepo("Y", new Dictionary <string, DepsContent>
                {
                    { "full-build *default", new DepsContent(null, new List <Dep> {
                            new Dep("B/full-build")
                        }) }
                });

                env.CreateRepo("B", new Dictionary <string, DepsContent>
                {
                    { "full-build > client *default", new DepsContent(null, new List <Dep>()) },
                    { "client", new DepsContent(null, new List <Dep> {
                            new Dep("B1")
                        }) }
                }, new[] { "master", "branch" });

                env.Checkout("B", "branch");
                using (new DirectoryJumper(Path.Combine(env.RemoteWorkspace, "B")))
                {
                    env.CreateDepsAndCommitThem(Path.Combine(env.RemoteWorkspace, "B"), new Dictionary <string, DepsContent>
                    {
                        { "full-build > client *default", new DepsContent(null, new List <Dep> {
                                new Dep("B2")
                            }) },
                        { "client", new DepsContent(null, new List <Dep> {
                                new Dep("B3")
                            }) }
                    });
                }

                env.CreateRepo("B1", new Dictionary <string, DepsContent> {
                    { "full-build *default", new DepsContent(null, new List <Dep>()) }
                });
                env.CreateRepo("B2", new Dictionary <string, DepsContent> {
                    { "full-build *default", new DepsContent(null, new List <Dep>()) }
                });
                env.CreateRepo("B3", new Dictionary <string, DepsContent> {
                    { "full-build *default", new DepsContent(null, new List <Dep>()) }
                });

                env.Get("A");

                Assert.AreEqual("branch", new GitRepository("B", dir, Log).CurrentLocalTreeish().Value);
                Assert.IsFalse(Directory.Exists(Path.Combine(dir, "B1")));
                Assert.IsTrue(Directory.Exists(Path.Combine(dir, "B2")));
                Assert.IsTrue(Directory.Exists(Path.Combine(dir, "B3")));
            }
        }