public void SelectedFieldViewModelPropertiesProxyShouldReturnDefaultValuesIfModelIsNull()
        {
            var vm = new ProcessFieldDisplayListRequiredStepViewModel.SelectedFieldViewModel();
            vm.Initialize(null, null);

            Assert.AreEqual(string.Empty, vm.DisplayName);
            Assert.AreEqual(string.Empty, vm.FullPath);
            Assert.AreEqual(0.0, vm.Order);
        }
        public void SelectedFieldViewModelPropertiesProxyTest()
        {
            var field = new DisplayListFieldEdit { FieldName = "dm", FullPath = "fp", Order = 2.0 };
            var vm = new ProcessFieldDisplayListRequiredStepViewModel.SelectedFieldViewModel();
            vm.Initialize(field, null);

            Assert.AreEqual("dm", vm.DisplayName);
            Assert.AreEqual("fp", vm.FullPath);
            Assert.AreEqual(2.0, vm.Order);
        }
 public void SelectedFieldViewModelPropertiesTest()
 {
     var vm = new ProcessFieldDisplayListRequiredStepViewModel.SelectedFieldViewModel();
     TestsHelper.TestPublicPropertiesGetSet(vm);
 }
        public void RemoveDisplayFieldCommand_CanExecuteTest()
        {
            // Arrange.
            var stepInfo = new StepInfo(123);
            var displayField1 = DisplayListFieldEdit.NewDisplayListFieldEdit();
            displayField1.Order = 1;
            var displayField2 = DisplayListFieldEdit.NewDisplayListFieldEdit();
            displayField2.Order = 2;

            var step = DisplayListRequiredStepEdit.NewStep(123);
            step.SelectedFields.Add(displayField1);

            var parentField = Mock.Create<ProcessFieldViewModel>(Constructor.Mocked, Behavior.Loose);
            var viewModel = new ProcessFieldDisplayListRequiredStepViewModel(step, stepInfo, parentField);

            var notSelectedField = new ProcessFieldDisplayListRequiredStepViewModel.SelectedFieldViewModel();
            notSelectedField.Initialize(displayField2, viewModel);

            var selectedFields =
                viewModel.OrderedSelectedFields.View.Cast<ProcessFieldDisplayListRequiredStepViewModel.SelectedFieldViewModel>().ToArray();

            // Act / Assert.
            Assert.IsFalse(viewModel.RemoveDisplayFieldCommand.CanExecute(null));
            Assert.IsTrue(viewModel.RemoveDisplayFieldCommand.CanExecute(selectedFields[0]));
            Assert.IsFalse(viewModel.RemoveDisplayFieldCommand.CanExecute(notSelectedField));
        }