public UsageEntryViewModel(IMessageBroker messageBroker, IConsumableUsageService usageService,
                                   IHenHouseService houseService, IConsumableService consumableService,
                                   SaveUsageCommand saveUsageCommand, CancelCommand cancelCommand, ShowUsageCommand showListCommand
                                   )
        {
            this.messageBroker     = messageBroker;
            this.usageService      = usageService;
            this.houseService      = houseService;
            this.consumableService = consumableService;

            this.saveUsageCommand = saveUsageCommand;
            this.showListCommand  = showListCommand;

            CancelCommand = cancelCommand;

            PropertiesToValidate = new List <string>()
            {
                "Date",
                "Total",
                "Details"
            };

            InitializeCommands();

            HouseList      = new ObservableCollection <HenHouse>(houseService.GetAll());
            ConsumableList = new ObservableCollection <Consumable>(consumableService.GetAll());

            SubscribeMessages();
        }
Exemplo n.º 2
0
        public void GetCommand_NoCommandArgument_ReturnsShowUsageCommand()
        {
            var showUsageCommand            = new ShowUsageCommand();
            Func <ShowUsageCommand> factory = () => showUsageCommand;

            var target  = new CommandFactory(factory, null, null, null, null, null, null, null);
            var command = target.GetCommand(new string[0]);

            Assert.AreSame(showUsageCommand, command);
        }