public void ValidRepoCommandLineIsParsed()
        {
            var commandLine = ValidRepoCommandLine();
            var settings    = SettingsParser.ReadSettings(commandLine);

            AssertSettingsNotNull(settings);
        }
        public void ValidRepoCommandLineHasDefaultGithubSettings()
        {
            var commandLine = ValidRepoCommandLine();
            var settings    = SettingsParser.ReadSettings(commandLine);

            AssertSettingsNotNull(settings);
            Assert.That(settings.GithubAuthSettings.ApiBase, Is.EqualTo(new Uri("https://api.github.com/")));
        }
        public void InvalidChangeIsNotParsed()
        {
            var commandLine = ValidRepoCommandLine()
                              .Append("change=fish");

            var settings = SettingsParser.ReadSettings(commandLine);

            Assert.That(settings, Is.Null);
        }
        public void ValidOrgCommandLineIsParsed()
        {
            var commandLine = ValidOrgCommandLine();
            var settings    = SettingsParser.ReadSettings(commandLine);

            AssertSettingsNotNull(settings);
            Assert.That(settings.ModalSettings, Is.Not.Null);
            Assert.That(settings.ModalSettings.OrganisationName, Is.EqualTo("NuKeeperDotNet"));
        }
Esempio n. 5
0
        public void ValidRepoCommandLineHasDefaultUserOptions()
        {
            var commandLine = ValidRepoCommandLine();
            var settings    = SettingsParser.ReadSettings(commandLine);

            AssertSettingsNotNull(settings);
            Assert.That(settings.UserSettings.MaxPullRequestsPerRepository, Is.EqualTo(3));
            Assert.That(settings.UserSettings.MinimumPackageAge, Is.EqualTo(TimeSpan.FromDays(7)));
        }
        public void InvalidLogLevelIsNotParsed()
        {
            var commandLine = ValidRepoCommandLine()
                              .Append("log=abigstick");

            var settings = SettingsParser.ReadSettings(commandLine);

            Assert.That(settings, Is.Null);
        }
        public void InvalidMaxPrIsNotParsed()
        {
            var commandLine = ValidRepoCommandLine()
                              .Append("maxpr=surewhynot");

            var settings = SettingsParser.ReadSettings(commandLine);

            Assert.That(settings, Is.Null);
        }
Esempio n. 8
0
        public void ValidRepoCommandLineHasDefaultUserEnums()
        {
            var commandLine = ValidRepoCommandLine();
            var settings    = SettingsParser.ReadSettings(commandLine);

            AssertSettingsNotNull(settings);
            Assert.That(settings.UserSettings.LogLevel, Is.EqualTo(LogLevel.Info));
            Assert.That(settings.UserSettings.ForkMode, Is.EqualTo(ForkMode.PreferFork));
            Assert.That(settings.UserSettings.ReportMode, Is.EqualTo(ReportMode.Off));
        }
Esempio n. 9
0
        public void ValidRepoCommandLineHasDefaultUserSettings()
        {
            var commandLine = ValidRepoCommandLine();
            var settings    = SettingsParser.ReadSettings(commandLine);

            AssertSettingsNotNull(settings);
            Assert.That(settings.UserSettings.NuGetSources, Is.EqualTo(new[] { "https://api.nuget.org/v3/index.json" }));
            Assert.That(settings.UserSettings.PackageIncludes, Is.Null);
            Assert.That(settings.UserSettings.PackageExcludes, Is.Null);
        }
Esempio n. 10
0
        public void ReportModeOverrideIsParsed()
        {
            var commandLine = ValidRepoCommandLine()
                              .Append("report=ReportOnly");

            var settings = SettingsParser.ReadSettings(commandLine);

            AssertSettingsNotNull(settings);
            Assert.That(settings.UserSettings.ReportMode, Is.EqualTo(ReportMode.ReportOnly));
        }
        public void AllowedChangeOverrideIsParsed()
        {
            var commandLine = ValidRepoCommandLine()
                              .Append("change=patch");

            var settings = SettingsParser.ReadSettings(commandLine);

            AssertSettingsNotNull(settings);
            Assert.That(settings.UserSettings.AllowedChange, Is.EqualTo(VersionChange.Patch));
        }
        public void ForkModeOverrideIsParsed()
        {
            var commandLine = ValidRepoCommandLine()
                              .Append("fork=PreferSingleRepository");

            var settings = SettingsParser.ReadSettings(commandLine);

            AssertSettingsNotNull(settings);
            Assert.That(settings.UserSettings.ForkMode, Is.EqualTo(ForkMode.PreferSingleRepository));
        }
        public void LogLevelOverrideIsParsed()
        {
            var commandLine = ValidRepoCommandLine()
                              .Append("log=verbose");

            var settings = SettingsParser.ReadSettings(commandLine);

            AssertSettingsNotNull(settings);
            Assert.That(settings.UserSettings.LogLevel, Is.EqualTo(LogLevel.Verbose));
        }
        public void MaxPrOverrideIsParsed()
        {
            var commandLine = ValidRepoCommandLine()
                              .Append("maxpr=42");

            var settings = SettingsParser.ReadSettings(commandLine);

            AssertSettingsNotNull(settings);
            Assert.That(settings.UserSettings.MaxPullRequestsPerRepository, Is.EqualTo(42));
        }
        public void ValidOrgCommandLineHasSpecifiedValues()
        {
            var commandLine = ValidOrgCommandLine();
            var settings    = SettingsParser.ReadSettings(commandLine);

            AssertSettingsNotNull(settings);
            Assert.That(settings.ModalSettings.Mode, Is.EqualTo(GithubMode.Organisation));
            Assert.That(settings.ModalSettings.OrganisationName, Is.EqualTo("NuKeeperDotNet"));
            Assert.That(settings.GithubAuthSettings.Token, Is.EqualTo("abc123"));
        }
        public void ValidRepoCommandLineHasDefaultUserSettings()
        {
            var commandLine = ValidRepoCommandLine();
            var settings    = SettingsParser.ReadSettings(commandLine);

            AssertSettingsNotNull(settings);
            Assert.That(settings.UserSettings.MaxPullRequestsPerRepository, Is.EqualTo(3));
            Assert.That(settings.UserSettings.LogLevel, Is.EqualTo(LogLevel.Info));
            Assert.That(settings.UserSettings.ForkMode, Is.EqualTo(ForkMode.PreferFork));
            Assert.That(settings.UserSettings.NuGetSources, Is.EqualTo(new[] { "https://api.nuget.org/v3/index.json" }));
        }
        public void ValidRepoCommandLineHasSpecifiedValues()
        {
            var commandLine = ValidRepoCommandLine();
            var settings    = SettingsParser.ReadSettings(commandLine);

            AssertSettingsNotNull(settings);
            Assert.That(settings.ModalSettings.Mode, Is.EqualTo(GithubMode.Repository));
            Assert.That(settings.ModalSettings.Repository, Is.Not.Null);
            Assert.That(settings.ModalSettings.Repository.RepositoryName, Is.EqualTo("NuKeeper"));
            Assert.That(settings.GithubAuthSettings.Token, Is.EqualTo("abc123"));
        }
Esempio n. 18
0
        public void InvalidMinPackageAgeIsParsed()
        {
            var commandLine = ValidRepoCommandLine()
                              .Append("MinAge=78ff");

            var settings = SettingsParser.ReadSettings(commandLine);

            Assert.That(settings, Is.Not.Null);
            Assert.That(settings.UserSettings, Is.Not.Null);
            Assert.That(settings.UserSettings.MinimumPackageAge, Is.EqualTo(TimeSpan.Zero));
        }
        public void MissingModeIsNotParsed()
        {
            var commandLine = new List <string>
            {
                "repo=https://github.com/NuKeeperDotNet/NuKeeper",
                "t=abc123"
            };

            var settings = SettingsParser.ReadSettings(commandLine);

            Assert.That(settings, Is.Null);
        }
        public void ShortOrgModeinCapsIsParsed()
        {
            var commandLine = new List <string>
            {
                "mode=Org",
                "org=NuKeeperDotNet",
                "t=abc123"
            };

            var settings = SettingsParser.ReadSettings(commandLine);

            AssertSettingsNotNull(settings);
            Assert.That(settings.ModalSettings.Mode, Is.EqualTo(GithubMode.Organisation));
        }
        public void ShortRepoModeIsParsed()
        {
            var commandLine = new List <string>
            {
                "mode=repo",
                "repo=https://github.com/NuKeeperDotNet/NuKeeper",
                "t=abc123"
            };

            var settings = SettingsParser.ReadSettings(commandLine);

            AssertSettingsNotNull(settings);
            Assert.That(settings.ModalSettings.Mode, Is.EqualTo(GithubMode.Repository));
        }
Esempio n. 22
0
        public static async Task <int> Main(string[] args)
        {
            var settings = SettingsParser.ReadSettings(args);

            if (settings == null)
            {
                Console.WriteLine("Exiting early...");
                return(1);
            }

            var container = ContainerRegistration.Init(settings);
            var engine    = container.GetInstance <GithubEngine>();
            await engine.Run();

            return(0);
        }
Esempio n. 23
0
        static void Main(string[] args)
        {
            SettingsParser parser = new SettingsParser("stw.sav");

            var jsonData = JsonConvert.SerializeObject(parser.ReadSettings(), Formatting.Indented);
        }