Ejemplo n.º 1
0
        public void GetConfigurationFromArguments_NoArguments_StandardValuesUsed()
        {
            var reader    = new ApplicationArgumentReader();
            var arguments = Array.Empty <string>();

            var(isValid, configuration) = reader.GetConfigurationFromArguments(arguments);

            Assert.That(isValid, Is.True);
            Assert.That(configuration !.Parallelism, Is.EqualTo(5));
        }
Ejemplo n.º 2
0
        public void GetConfigurationFromArguments_ArgumentValueNotInRange_InvalidConfiguration()
        {
            var reader = new ApplicationArgumentReader();

            string[] arguments = { "runs=2", "parallelism=0" };

            var(isValid, _) = reader.GetConfigurationFromArguments(arguments);

            Assert.That(isValid, Is.False);
        }
Ejemplo n.º 3
0
        public void GetConfigurationFromArguments_UnknownArguments_AreIgnored()
        {
            var reader = new ApplicationArgumentReader();

            string[] arguments = { "one=two", "three", "99" };

            var(isValid, _) = reader.GetConfigurationFromArguments(arguments);

            Assert.That(isValid, Is.True);
        }
Ejemplo n.º 4
0
        public void GetConfigurationFromArguments_PlayerTypesGiven_HasTournamentTypes()
        {
            var reader = new ApplicationArgumentReader();

            string[] arguments = { "runs=2", "1", "3" };

            var(isValid, configuration) = reader.GetConfigurationFromArguments(arguments);

            Assert.That(isValid, Is.True);
            Assert.That(configuration !.AvailablePlayers.Count, Is.EqualTo(2));
        }
Ejemplo n.º 5
0
        public void GetConfigurationFromArguments_DuplicatePlayerTypesGiven_IgnoresDuplicatePlayerTypes()
        {
            var reader = new ApplicationArgumentReader();

            string[] arguments = { "1", "2", "2", "3", "3", "3" };

            var(isValid, configuration) = reader.GetConfigurationFromArguments(arguments);

            Assert.That(isValid, Is.True);
            Assert.That(configuration !.AvailablePlayers.Count, Is.EqualTo(3));
        }
Ejemplo n.º 6
0
        public void GetConfigurationFromArguments_NoPlayerTypeGiven_AllAvailablePlayersUsed()
        {
            var reader = new ApplicationArgumentReader();

            string[] arguments = Array.Empty <string>();

            var(isValid, configuration) = reader.GetConfigurationFromArguments(arguments);

            Assert.That(isValid, Is.True);
            Assert.That(configuration !.AvailablePlayers.Count,
                        Is.EqualTo(Enum.GetValues(typeof(AvailablePlayer)).Length));
        }
Ejemplo n.º 7
0
        public void GetConfigurationFromArguments_CaseOfArgumentsDoesNotMatter_AreIgnored()
        {
            var reader = new ApplicationArgumentReader();

            string[] arguments = { "RUns=2", "PARALLELISM=5" };

            var(isValid, configuration) = reader.GetConfigurationFromArguments(arguments);

            Assert.That(isValid, Is.True);
            Assert.That(configuration !.Runs, Is.EqualTo(2));
            Assert.That(configuration !.Parallelism, Is.EqualTo(5));
        }