private static void SetupItemToDeleteOn(CmdApplicationConfigurationListViewModel sut)
 {
     sut.SelectedConfiguration = sut.ApplicationConfigurations.First();
     var vm = new NameOnlyParameterViewModel((Name)"testParameter");
     vm.IsSelected = true;
     sut.SelectedConfiguration.Properties.Add(vm);
 }
 public void OnDeleteCmdApplicationConfigurationEventRemovesItem(
     CmdApplicationConfigurationListViewModel sut,
     ConfigurationDeletedEvent eventMessage)
 {
     var expected = sut.ApplicationConfigurations.Count - 1;
     SetupItemToDeleteOn(sut);
     sut.Handle(eventMessage);
     Assert.Equal(expected, sut.ApplicationConfigurations.Count);
 }
        public void OnDeleteCmdApplicationConfigurationEventRaisesCommandDeleteItem(
            [Frozen]Mock<IChannel<DeleteCmdApplicationConfigurationCommand>> channel,
            CmdApplicationConfigurationListViewModel sut,
            DeleteCmdApplicationConfigurationEvent eventMessage)
        {
            SetupItemToDeleteOn(sut);

            sut.OnDeleteCmdApplicationConfigurationEvent(eventMessage);
            channel.Verify(a => a.Send(It.IsAny<DeleteCmdApplicationConfigurationCommand>()), Times.Once());
        }
Esempio n. 4
0
 public MainViewModel(
     ICmdApplicationConfigurationViewModelFactory factory, 
     CmdApplicationConfigurationListViewModel cmdApplicationConfigurationListViewModel,
     IMessenger messenger)
 {
     this.CmdApplicationConfigurationListViewModel = cmdApplicationConfigurationListViewModel;
     this.AddCommand = new RelayCommand(this.OnAddExecuted);
     this.DeleteCommand = new RelayCommand(this.OnDeleteExecuted);
     this.Messenger = messenger;
 }
 public void OnAddNewConfigurationSelectedItemIsSetToNewItem(
     [Frozen]Mock<ICmdApplicationConfigurationViewModelFactory> mockFactory,
     IChannel<SaveCmdApplicationConfigurationCommand> channel,
     CmdApplicationConfigurationViewModel expected,
     CmdApplicationConfigurationListViewModel sut,
     AddCmdApplicationConfigurationEvent eventMessage)
 {
     SetUpFactoryToReturnANewInstance(expected, mockFactory);
     sut.OnAddCmdApplicationConfigurationEvent(eventMessage);
     Assert.Equal(expected, sut.SelectedConfiguration);
 }
 public void SutIsViewModelBase(CmdApplicationConfigurationListViewModel sut)
 {
     Assert.IsAssignableFrom<ViewModelBase>(sut);
 }