public void VerifyThatContainerIsSetForRuleUpdate() { var rule = new ParameterizedCategoryRule(Guid.NewGuid(), null, this.uri); var vm = new ParameterizedCategoryRuleDialogViewModel(rule, this.transaction, this.session.Object, true, ThingDialogKind.Create, this.dialogService.Object); Assert.AreEqual(2, vm.PossibleContainer.Count); }
public void VerifyThatAllPropertiesArePopulated() { var shortname = "shortname"; var name = "name"; var rule = new ParameterizedCategoryRule(Guid.NewGuid(), null, this.uri); rule.ShortName = shortname; rule.Name = name; rule.Category = this.cat; var pt = new TextParameterType(Guid.NewGuid(), null, this.uri); this.siteRdl.ParameterType.Add(pt); this.siteRdl.Rule.Add(rule); rule.ParameterType.Add(this.siteRdl.ParameterType.First()); var vm = new ParameterizedCategoryRuleDialogViewModel(rule, this.transaction, this.session.Object, true, ThingDialogKind.Inspect, this.dialogService.Object); Assert.AreEqual(shortname, vm.ShortName); Assert.AreEqual(name, vm.Name); Assert.AreEqual(1, vm.PossibleCategory.Count); Assert.AreEqual(this.cat, vm.PossibleCategory.First()); Assert.AreEqual(this.cat, vm.SelectedCategory); Assert.AreEqual(1, vm.PossibleParameterType.Count); Assert.AreEqual(pt, vm.PossibleParameterType.First()); Assert.AreEqual(1, vm.ParameterType.Count); Assert.AreEqual(pt, vm.ParameterType.First()); Assert.IsTrue(vm.OkCanExecute); }
public void VerifyDialogValidation() { var rule = new ParameterizedCategoryRule(Guid.NewGuid(), null, this.uri); var vm = new ParameterizedCategoryRuleDialogViewModel(rule, this.transaction, this.session.Object, true, ThingDialogKind.Inspect, this.dialogService.Object); Assert.IsFalse(vm.OkCanExecute); }
public void VerifyThatContainerIsSetForRuleInspect() { var expectedContainers = new List <ReferenceDataLibrary> { this.siteRdl }; var rule = new ParameterizedCategoryRule(Guid.NewGuid(), null, this.uri); this.siteRdl.Rule.Add(rule); var vm = new ParameterizedCategoryRuleDialogViewModel(rule, this.transaction, this.session.Object, true, ThingDialogKind.Inspect, this.dialogService.Object); CollectionAssert.AreEquivalent(expectedContainers, vm.PossibleContainer); }
public void VerifyUpdateOkCanExecute() { var rule = new ParameterizedCategoryRule(Guid.NewGuid(), null, this.uri); var vm = new ParameterizedCategoryRuleDialogViewModel(rule, this.transaction, this.session.Object, true, ThingDialogKind.Create, this.dialogService.Object); Assert.IsFalse(vm.OkCanExecute); vm.Container = this.siteRdl; Assert.IsFalse(vm.OkCanExecute); vm.SelectedCategory = this.cat; Assert.IsFalse(vm.OkCanExecute); var pt = new TextParameterType(Guid.NewGuid(), null, this.uri); vm.ParameterType.Add(pt); Assert.IsTrue(vm.OkCanExecute); }
/// <summary> /// Filters the ParameterTypesGrid according to the value of the ShowAllParameterTypes checkBox /// </summary> /// <param name="sender"> /// The ParameterTypesGrid. /// </param> /// <param name="e"> /// The <see cref="RowFilterEventArgs"/> event. /// </param> private void SelectedParameterTypeFilter(object sender, RowFilterEventArgs e) { if (this.viewModel == null) { this.viewModel = this.DataContext as ParameterizedCategoryRuleDialogViewModel; } if (this.ShowAllParameterTypes.IsChecked.Value) { e.Visible = true; } else { var row = this.ParameterTypesGrid.GetRow(e.ListSourceRowIndex) as ParameterType; e.Visible = this.viewModel.ParameterType.Contains(row); } e.Handled = !e.Visible; }