public void RichTextEvent()
        {
            // arrange
            var commonStepEdit = DataPortal.CreateChild<CommonStepEdit>();
            var fieldTypeInfo = new FieldTypeInfo();
            var fieldEdit = DataPortal.CreateChild<FieldEdit>();
            fieldEdit.FieldType = fieldTypeInfo;
            var processFieldViewModel = new ProcessFieldViewModel(fieldEdit, null);
            var vm = new ProcessFieldCommonStepViewModel(commonStepEdit, new StepInfo(), processFieldViewModel);

            // act
            vm.HandleEvent(new IsRichTextAllowedChangedEvent(true));
            
            // assert
            Assert.IsFalse(vm.IsEnabledWidth);
            Assert.AreEqual(8, vm.Data.RowSpan);
            Assert.IsTrue(vm.Data.IsRichTextAllowed);

            // act
            vm.HandleEvent(new IsRichTextAllowedChangedEvent(false));

            // assert
            Assert.IsTrue(vm.IsEnabledWidth);
            Assert.AreEqual(1, vm.Data.RowSpan);
            Assert.IsFalse(vm.Data.IsRichTextAllowed);
        }
        public void OnImportsSatisfied()
        {
            // arrange
            var commonStepEdit = DataPortal.CreateChild<CommonStepEdit>();
            var fieldTypeInfo = new FieldTypeInfo();
            var fieldEdit = DataPortal.CreateChild<FieldEdit>();
            fieldEdit.FieldType = fieldTypeInfo;
            var processFieldViewModel = new ProcessFieldViewModel(fieldEdit, null);
            var vm = new ProcessFieldCommonStepViewModel(commonStepEdit, new StepInfo(), processFieldViewModel)
                {
                    EventAggregator = new EventAggregatorService(),
                    Model = new ProcessFieldsViewModel { SelectedSection = new ProcessSectionViewModel(DataPortal.CreateChild<SectionEdit>()) }
                };

            // act
            vm.OnImportsSatisfied();

            // assert
            Assert.IsNotNull(vm.SelectedSection);
        }
        public void PropertyIsEnabledWidth()
        {
            // arrange
            var commonStepEdit = DataPortal.CreateChild<CommonStepEdit>();
            var fieldTypeInfo = new FieldTypeInfo();
            var fieldEdit = DataPortal.CreateChild<FieldEdit>();
            fieldEdit.FieldType = fieldTypeInfo;
            var processFieldViewModel = new ProcessFieldViewModel(fieldEdit, null);
            var vm = new ProcessFieldCommonStepViewModel(commonStepEdit, new StepInfo(), processFieldViewModel);

            // act
            vm.IsEnabledWidth = false;

            // assert
            Assert.AreEqual(100, vm.Data.Width);

            // act
            vm.IsEnabledWidth = true;

            // assert
            Assert.AreEqual(50, vm.Data.Width);
        }
        public void MaskEvent()
        {
            // arrange
            var commonStepEdit = DataPortal.CreateChild<CommonStepEdit>();
            var fieldTypeInfo = new FieldTypeInfo();
            var fieldEdit = DataPortal.CreateChild<FieldEdit>();
            fieldEdit.FieldType = fieldTypeInfo;
            var processFieldViewModel = new ProcessFieldViewModel(fieldEdit, null);
            var vm = new ProcessFieldCommonStepViewModel(commonStepEdit, new StepInfo(), processFieldViewModel);

            // act
            vm.HandleEvent(new MaskChangedEvent("00000", "Standart"));

            // assert
            Assert.AreEqual("00000", vm.Data.Mask);
            Assert.AreEqual("Standart", vm.Data.MaskType);
        }
        public void OnFieldListChangedEvent_RaisePropertyChanged_IsAllowLocalizedDataEnabled()
        {
            // Arrange.
            var fieldEdit = Mock.Create<FieldEdit>(Constructor.Mocked, Behavior.Loose);
            fieldEdit.FieldType = CreateFieldType(ColumnTypes.String);

            var fieldViewModel = Mock.Create<ProcessFieldViewModel>(Constructor.Mocked, Behavior.Loose);
            Mock.Arrange(() => fieldViewModel.Model).Returns(fieldEdit);
            var commonStepEdit = DataPortal.CreateChild<CommonStepEdit>();
            var vm = new ProcessFieldCommonStepViewModel(commonStepEdit, new StepInfo(), fieldViewModel);

            // Act.
            var changedProperties = new HashSet<string>();
            vm.PropertyChanged += (sender, args) => changedProperties.Add(args.PropertyName);

            vm.HandleEvent(new FieldListChangedEvent(FieldOperation.Changed, fieldViewModel, "FieldType"));

            // Assert.
            Assert.IsTrue(changedProperties.Contains(ReflectionHelper.GetPropertyName<ProcessFieldCommonStepViewModel>(x => x.IsAllowLocalizedDataEnabled)));
        }
        public void IsAllowLocalizedDataEnabledTest()
        {
            // Arrange.
            var fieldEdit = Mock.Create<FieldEdit>(Constructor.Mocked, Behavior.Loose);
            fieldEdit.FieldType = CreateFieldType(ColumnTypes.String);

            var fieldViewModel = Mock.Create<ProcessFieldViewModel>(Constructor.Mocked, Behavior.Loose);
            Mock.Arrange(() => fieldViewModel.Model).Returns(fieldEdit);
            var commonStepEdit = DataPortal.CreateChild<CommonStepEdit>();

            var vm = new ProcessFieldCommonStepViewModel(commonStepEdit, new StepInfo(), fieldViewModel);

            Mock.Arrange(() => fieldEdit.IsLocalizable).Returns(false);

            // Act / Assert.
            Assert.IsFalse(vm.IsAllowLocalizedDataEnabled);

            // Arrange.
            Mock.Arrange(() => fieldEdit.IsLocalizable).Returns(true);

            // Act / Assert.
            Assert.IsTrue(vm.IsAllowLocalizedDataEnabled);
        }