Exemplo n.º 1
0
 public AddAccountCommand(string rawText, RepositoryBag repositories, string accountName) : base(rawText, repositories)
 {
     AccountId          = new IntegerCommandOption(CommandOptionKind.Account);
     AccountName        = new StringCommandOption(CommandOptionKind.Name);
     CategoryNameOption = new StringCommandOption(CommandOptionKind.Category);
     DescriptionOption  = new StringCommandOption(CommandOptionKind.Description);
     FundsOption        = new MoneyCommandOption(CommandOptionKind.Funds);
     PriorityOption     = new IntegerCommandOption(CommandOptionKind.Priority);
     AccountTypeOption  = new EnumCommandOption <AccountKind>(CommandOptionKind.AccountType);
     AccountName.SetData(accountName);
 }
        public void TestStringOptionParsing()
        {
            string value1 = "test string";

            StringCommandOption option = new StringCommandOption(CommandOptionKind.Date);
            string parsedData;
            bool   successful = option.TryParseData("test string", out parsedData);

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

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