Esempio n. 1
0
        public void RepoObjectTree_should_show_all_submodules()
        {
            RunFormTest(
                form =>
            {
                // act
                SubmoduleTestHelpers.UpdateSubmoduleStructureAndWaitForResult(_provider, _repo1Module);

                // assert
                var submodulesNode = GetSubmoduleNode(form);

                submodulesNode.Nodes.Count.Should().Be(1);

                var repo1Node = submodulesNode.Nodes[0];
                repo1Node.Name.Should().StartWith("repo1");
                repo1Node.Nodes.Count.Should().Be(1);

                var repo2Node = repo1Node.Nodes[0];
                repo2Node.Name.Should().StartWith("repo2");
                repo2Node.Nodes.Count.Should().Be(1);

                var repo3Node = repo2Node.Nodes[0];
                repo3Node.Name.Should().StartWith("repo3");
                repo3Node.Nodes.Count.Should().Be(0);
            });
        }
            public void Submodule_status_changes_for_top_module()
            {
                var currentModule = _repo1Module;
                var result        = SubmoduleTestHelpers.UpdateSubmoduleStructureAndWaitForResult(_provider, currentModule);

                // No changes in repo
                var changedFiles = GetStatusChangedFiles(currentModule);

                changedFiles.Should().HaveCount(0);
                SubmoduleTestHelpers.UpdateSubmoduleStatusAndWaitForResult(_provider, currentModule, changedFiles);
                result.OurSubmodules.All(i => i.Detailed == null).Should().BeTrue();

                // Make a change in repo2
                _repo1.CreateFile(_repo2Module.WorkingDir, "test.txt", "test");
                changedFiles = GetStatusChangedFiles(currentModule);
                changedFiles.Should().HaveCount(1);
                SubmoduleTestHelpers.UpdateSubmoduleStatusAndWaitForResult(_provider, currentModule, changedFiles);

                result.OurSubmodules[0].Detailed.IsDirty.Should().BeTrue();
                result.OurSubmodules[1].Detailed.Should().BeNull();

                // Revert the change
                File.Delete(Path.Combine(_repo2Module.WorkingDir, "test.txt"));
                changedFiles = GetStatusChangedFiles(currentModule);
                changedFiles.Should().HaveCount(0);
                SubmoduleTestHelpers.UpdateSubmoduleStatusAndWaitForResult(_provider, currentModule, changedFiles);
                result.OurSubmodules.All(i => i.Detailed == null).Should().BeTrue();
            }
            public void UpdateSubmoduleStructure_valid_result_for_second_nested_submodule()
            {
                var result = SubmoduleTestHelpers.UpdateSubmoduleStructureAndWaitForResult(_provider, _repo3Module, true);

                result.TopProject.Path.Should().Be(_repo1Module.WorkingDir);
                result.SuperProject.Path.Should().Be(_repo2Module.WorkingDir);
                result.CurrentSubmoduleName.Should().Be("repo3");
                result.OurSubmodules.Select(info => info.Path).Should().BeEmpty();
                result.SuperSubmodules.Select(info => info.Path).Should().Contain(_repo2Module.WorkingDir, _repo3Module.WorkingDir);
                result.OurSubmodules.All(i => i.Detailed == null).Should().BeTrue();
            }