Esempio n. 1
0
        public void TestIntegerRangeOptionParsingFromConstructor(string rawText, long expectedIntegerRangeStart, long expectedIntegerRangeEnd, bool isFromInclusive, bool isToInclusive)
        {
            Range <long> expected = new Range <long>(expectedIntegerRangeStart, expectedIntegerRangeEnd, isFromInclusive, isToInclusive);


            IntegerRangeCommandOption option = new IntegerRangeCommandOption(CommandOptionKind.Date, rawText);

            Assert.Equal(expected, option.GetValue(null));
        }
Esempio n. 2
0
 public ListAccountCommand(string rawText, RepositoryBag repositories) : base(rawText, repositories)
 {
     IdOption          = new IntegerCommandOption(CommandOptionKind.Id);
     CategoryIdOption  = new IntegerCommandOption(CommandOptionKind.Category);
     DescriptionOption = new StringCommandOption(CommandOptionKind.Description);
     NameOption        = new StringCommandOption(CommandOptionKind.Name);
     PriorityOption    = new IntegerRangeCommandOption(CommandOptionKind.Priority);
     FundsOption       = new MoneyRangeCommandOption(CommandOptionKind.FundsExpr);
     AccountTypeOption = new EnumCommandOption <AccountKind>(CommandOptionKind.AccountType);
 }
Esempio n. 3
0
        public void TestIntegerRangeOptionParsing()
        {
            long         from  = 123456;
            long         to    = 987654;
            Range <long> range = new Range <long>(from, to);

            IntegerRangeCommandOption option = new IntegerRangeCommandOption(CommandOptionKind.Date);
            Range <long> parsedData;
            bool         successful = option.TryParseData("[123456, 987654]", out parsedData);

            Assert.True(successful);
            Assert.Equal(range, parsedData);

            successful = option.SetData("asdf");
            Assert.False(successful);
            Assert.False(option.IsDataValid);

            successful = option.SetData("-6634");
            Assert.True(successful);
            Assert.True(option.IsDataValid);
        }