public void WriteUsage(TextWriter textWriter) { var taxabilityKeys = String.Join("|", TaxabilityType.GetAll().Select(x => x.Key).ToArray()); textWriter.WriteLine(String.Join(" ", this.GetCommandWords()) + " [type name|index#] [" + taxabilityKeys + "]"); textWriter.WriteLine(UsageMessageText, typeof(TaxabilityType).GetSingularUIDescription(), typeof(AccountType).GetSingularUIDescription()); }
public Notification Execute(ExecutionArguments executionArguments) { Statement statement = executionArguments.Statement; var accountType = statement.AccountTypes.GetByPropertyValueOrIndex(x => x.Name, executionArguments.Args[0]); accountType.Taxability = TaxabilityType.GetFor(executionArguments.Args[1]); return(Notification.InfoFor(SuccessMessageText, typeof(TaxabilityType).GetSingularUIDescription())); }
public Notification Check(ExecutionArguments executionArguments, int argumentIndex) { var argument = executionArguments.Args[argumentIndex]; var taxabilityType = TaxabilityType.GetFor(argument); if (taxabilityType == null) { return(Notification.ErrorFor(InvalidTaxabilityType, executionArguments.Args[1], typeof(TaxabilityType).GetSingularUIDescription())); } return(Notification.Empty); }
public Notification Execute(ExecutionArguments executionArguments) { var accountType = new AccountType { Name = executionArguments.Args[0], Taxability = TaxabilityType.GetFor(executionArguments.Args[1]) }; Statement statement = executionArguments.Statement; statement.AccountTypes.Add(accountType); return(Notification.InfoFor(SuccessMessageText, typeof(AccountType).GetSingularUIDescription())); }
protected override void Before_first_test() { var accountType = Init.GetDefaultAccountTypes().First(); _expectedTaxabilityType = TaxabilityType.GetAll().First(x => x != accountType.Taxability); _executionArguments = Subcutaneous.FromCommandline() .Init(@"x:\previous.statement") .ClearOutput() .CreateExecutionArguments(Init.GetDefaultAccountTypes().First().Name, _expectedTaxabilityType.Key); var command = IoC.Get <ChangeAccountTypeTaxabilityType>(); _result = command.Execute(_executionArguments); }