Esempio n. 1
0
        public void Argument_EnumValues()
        {
            var argument = new CommandArgumentDescriptor(
                typeof(TestEnum),
                "test",
                0,
                "",
                CoconaDefaultValue.None,
                new Attribute[] { }
                );
            var metadata = new CoconaCompletionCandidatesMetadata(
                CompletionCandidateType.Provider,
                typeof(EnumCompletionCandidatesProvider),
                argument
                );

            var provider   = new EnumCompletionCandidatesProvider();
            var candidates = provider.GetCandidates(metadata);

            candidates.ResultType.Should().Be(CompletionCandidateResultType.Keywords);
            candidates.Values.Should().HaveCount(2);
            candidates.Values[0].Value.Should().Be("Alice");
            candidates.Values[0].Description.Should().Be(string.Empty);
            candidates.Values[1].Value.Should().Be("Karen");
            candidates.Values[1].Description.Should().Be(string.Empty);
        }
Esempio n. 2
0
        public void Argument_Default()
        {
            var argument = new CommandArgumentDescriptor(
                typeof(int),
                "test",
                0,
                "",
                CoconaDefaultValue.None,
                new Attribute[] { }
                );
            var metadata = new CoconaCompletionCandidatesMetadata(
                CompletionCandidateType.Provider,
                typeof(EnumCompletionCandidatesProvider),
                argument
                );

            var provider   = new EnumCompletionCandidatesProvider();
            var candidates = provider.GetCandidates(metadata);

            candidates.ResultType.Should().Be(CompletionCandidateResultType.Default);
        }
Esempio n. 3
0
        public void Option_Default()
        {
            var option = new CommandOptionDescriptor(
                typeof(int),
                "test",
                Array.Empty <char>(),
                "",
                CoconaDefaultValue.None,
                string.Empty,
                CommandOptionFlags.None,
                new Attribute[] { }
                );
            var metadata = new CoconaCompletionCandidatesMetadata(
                CompletionCandidateType.Provider,
                typeof(StaticCompletionCandidatesProvider),
                option
                );
            var provider   = new EnumCompletionCandidatesProvider();
            var candidates = provider.GetCandidates(metadata);

            candidates.ResultType.Should().Be(CompletionCandidateResultType.Default);
        }