Esempio n. 1
0
        public void AddLabel_CancelMessageIsPublished_NewLabelIsRemoved()
        {
            _viewModel.BeginEdit();
            _viewModel.AddLabelCommand.Execute(null);
            var newLabel = _viewModel.CustomLabels[0];

            _viewModel.CancelEdit();

            Assert.Empty(_viewModel.CustomLabels);
        }
        public void AddLabel_ThenCancel()
        {
            _viewModel.BeginEdit();
            _viewModel.AddLabelCommand.Execute(null);
            var newLabel = _viewModel.CustomLabels[0];

            _viewModel.CancelEdit();

            Assert.AreEqual(0, _viewModel.CustomLabels.Count);
        }
Esempio n. 3
0
        public void RemoveLabel_CancelMessageIsPublished_DeletedLabelIsAddedBack()
        {
            _appSettingsMock.SetupGet(x => x.CustomLabels).Returns(new List <CustomLabel> {
                new CustomLabel()
            });
            _dialogMock.Setup(o => o.ShowConfirmationDialog(It.IsAny <ConfirmationDialogType>(), It.IsAny <object>())).Returns(true);
            _viewModel = new CustomLabelsViewModel(_appSettingsMock.Object, _dialogMock.Object, _sessionMock.Object, _messageBus.Object);
            _viewModel.BeginEdit();
            var label = _viewModel.CustomLabels[0];

            _viewModel.RemoveLabelCommand.Execute(label);
            _viewModel.CancelEdit();

            Assert.Single(_viewModel.CustomLabels);
            Assert.Equal(label, _viewModel.CustomLabels[0]);
        }