예제 #1
0
        public void VerifyThatGitHubIgnoreFileWasDownloaded()
        {
            var sut           = new IFix.GitIgnore(GitDirectory); // Make sure we create it and thus also download the file.
            var temp          = Path.GetTempPath();
            var tempgitignore = temp + "/VisualStudio.gitignore";

            Assert.That(File.Exists(tempgitignore), "No temporary gitignore found at " + tempgitignore);
        }
예제 #2
0
        public void FindMyOwnGitRepo()
        {
            var sut = new IFix.GitIgnore(GitDirectory);

            Assert.That(sut.Repositories.Count() == 1, "Can't find my own repo");
            var file = sut.Repositories.First().File;

            Assert.That(File.Exists(file), "No gitignore file");
        }
예제 #3
0
        public void FindMyOwnGitRepo()
        {
            var sut = new IFix.GitIgnore(GitDirectory);

            Assert.That(sut.Repositories.Count(), Is.EqualTo(1), $"Can't find my own repo at {GitDirectory}");
            string file = sut.Repositories.First().File;

            Assert.That(File.Exists(file), "No gitignore file");
        }
예제 #4
0
        public void VerifyWithNoPackages()
        {
            var testdata = ResourceReader.Read(WO);

            var sut = new IFix.GitIgnore(GitDirectory);

            var result = sut.CheckIfNuGetPackages(testdata, false, false);

            Assert.That(result, Is.False);
        }
예제 #5
0
        public void VerifyMissing()
        {
            var gitignorelines = ResourceReader.Read(W);
            var stdlines       = ResourceReader.Read(STD);

            var sut = new IFix.GitIgnore(GitDirectory);

            var result = sut.CheckIfOurContainsStd(gitignorelines, stdlines);

            Assert.That(result.Any());
        }
예제 #6
0
        public void VerifyAddMissing2()
        {
            var lines = new List <string> {
                "Somestart", @"**/packages/*"
            };

            var sut = new IFix.GitIgnore(GitDirectory);

            var outlines = sut.AddOnlyMissingInfo(lines);

            Assert.That(outlines.Count() == 7, "Count was " + outlines.Count());
        }
예제 #7
0
        public void VerifyAddMissing()
        {
            var lines = new List <string> {
                "Somestart"
            };

            var sut = new IFix.GitIgnore(GitDirectory);

            var outlines = sut.AddOnlyMissingInfo(lines);

            Assert.That(outlines.Count(), Is.EqualTo(7), "Count was " + outlines.Count());
        }
예제 #8
0
        public void VerifyWithAddingInfo()
        {
            var testdata = ResourceReader.Read(WO);

            var sut = new IFix.GitIgnore(GitDirectory);

            var result = sut.CheckIfNuGetPackages(testdata, false, false);

            Assert.That(result, Is.False, "Testdata contains packages or CheckIfPackages failed");
            var outlines = sut.AddOnlyMissingInfo(testdata);

            result = sut.CheckIfNuGetPackages(outlines, false, false);
            Assert.That(result, "Add missing info failed");
        }
예제 #9
0
        public void VerifyGitHubIgnore()
        {
            var testdata = ResourceReader.Read(GitHubVS);

            Assert.That(testdata.Any(l => l.Trim() == @"packages/*"), Is.False, "githubignore contained the packages/*");
            var sut = new IFix.GitIgnore(GitDirectory);

            var result = sut.CheckIfNuGetPackages(testdata, false, false);

            Assert.That(result, Is.True);
            var outlines = sut.AddOnlyMissingInfo(testdata);

            Assert.That(outlines.Any(l => l.Trim() == @"packages/*"), "packages/* was not added");
        }
예제 #10
0
        public void CheckDownload()
        {
            var assemblyLoc = Assembly.GetExecutingAssembly().Location;
            var currentPath = Path.GetFullPath(Path.Combine(assemblyLoc, @"../../../"));

            var sut = new IFix.GitIgnore(currentPath);

            var temp          = Path.GetTempPath();
            var tempGitIgnore = temp + "/VisualStudio.gitignore";

            sut.DownloadGitIgnore(tempGitIgnore);
            var lines = File.ReadAllLines(tempGitIgnore);

            Assert.That(lines.Any());
            Assert.That(lines[0], Does.StartWith("##"));
        }