public void OnInit_ShouldAdd_CurrentStateField() { var viewConfigurator = new DataCollectProcessViewConfigurator(); var process = Mock.Create<ProcessEdit>(Behavior.Loose); process.IsStateEnabled = true; process.FilterList = new ProcessFilterList(); process.ViewList = new ProcessViewList(); var processVVM = new ProcessViewsViewModel { Model = process }; var vm = new DataCollectionProcessViewConfiguratorViewModel(); vm.Init(viewConfigurator, processVVM); var currentStateFieldVM = vm.AvailableFields.FirstOrDefault(f => f.Name.Contains(Constants.CurrentStateColumnName)); Assert.IsNotNull(currentStateFieldVM); Assert.IsTrue(currentStateFieldVM.Model.IsBuiltIn); }
private static void OnModelChildChanged(DataCollectionProcessViewConfiguratorViewModel viewModel, object sender, ChildChangedEventArgs e) { if (e.ChildObject is ProcessFilterList || e.ChildObject is ProcessFilterEdit) { var selectedFilter = viewModel.ViewConfigurator == null ? Guid.Empty : viewModel.ViewConfigurator.FilterGuid; viewModel.LoadFilters(); viewModel._isLoading = true; viewModel.UpdateUdps(); viewModel._isLoading = false; if (viewModel.ViewConfigurator != null && viewModel._processFilters.Any(x => x.GuidId == selectedFilter)) { viewModel.ViewConfigurator.FilterGuid = selectedFilter; } } }