public void VerifyThatPopulatePossibleScalesWorks() { this.session.Setup(x => x.RetrieveSiteDirectory()).Returns(this.siteDir); this.session.Setup(x => x.ActivePerson).Returns(new Person(Guid.NewGuid(), null, this.uri)); var pt = new SimpleQuantityKind(Guid.NewGuid(), null, this.uri) { ShortName = "test" }; this.mrdl.ParameterType.Add(pt); var scale = new RatioScale(Guid.NewGuid(), null, this.uri) { ShortName = "testms" }; this.mrdl.Scale.Add(scale); pt.PossibleScale.Add(scale); var vm = new SimpleParameterValueDialogViewModel(this.parameterValue.Clone(false), this.thingTransaction, this.session.Object, true, ThingDialogKind.Update, this.thingDialogNavigationService.Object, this.requirementClone); vm.SelectedParameterType = pt; Assert.AreEqual(0, vm.PossibleScale.Count); }
public void VerifyThatPopulateValuesForCompoundParameterTypesWorks() { this.parameterValue = new SimpleParameterValue(Guid.NewGuid(), this.cache, this.uri) { ParameterType = null }; this.session.Setup(x => x.RetrieveSiteDirectory()).Returns(this.siteDir); this.session.Setup(x => x.ActivePerson).Returns(new Person(Guid.NewGuid(), null, this.uri)); var valueClone = this.parameterValue.Clone(false); this.requirementClone.ParameterValue.Add(valueClone); var vm = new SimpleParameterValueDialogViewModel(valueClone, this.thingTransaction, this.session.Object, true, ThingDialogKind.Update, this.thingDialogNavigationService.Object, this.requirementClone); var selectedParameter = new CompoundParameterType(); var parameterTypeComponent = new ParameterTypeComponent(); var selectedSimpleParameter = new SimpleQuantityKind(); parameterTypeComponent.ParameterType = selectedSimpleParameter; selectedParameter.Component.Add(parameterTypeComponent); vm.SelectedParameterType = selectedParameter; Assert.AreEqual(vm.Values.Count, 1); Assert.AreSame(vm.Values.First().ParameterType, selectedParameter); }
public void VerifyThatPopulatePossibleParameterTypesWorks() { this.session.Setup(x => x.RetrieveSiteDirectory()).Returns(this.siteDir); this.session.Setup(x => x.ActivePerson).Returns(new Person(Guid.NewGuid(), null, this.uri)); var vm = new SimpleParameterValueDialogViewModel(this.parameterValue.Clone(false), this.thingTransaction, this.session.Object, true, ThingDialogKind.Update, this.thingDialogNavigationService.Object, this.requirementClone); Assert.AreEqual(1, vm.PossibleParameterType.Count); }
public void VerifyThatTheExecuteCreateValueCommandAddsANewRow() { this.session.Setup(x => x.RetrieveSiteDirectory()).Returns(this.siteDir); this.session.Setup(x => x.ActivePerson).Returns(new Person(Guid.NewGuid(), null, this.uri)); this.mrdl.ParameterType.Add(new SimpleQuantityKind(Guid.NewGuid(), null, this.uri) { ShortName = "test" }); var vm = new SimpleParameterValueDialogViewModel(this.parameterValue.Clone(false), this.thingTransaction, this.session.Object, true, ThingDialogKind.Update, this.thingDialogNavigationService.Object, this.requirementClone); Assert.IsNull(vm.SelectedValue); }
public void VerifyThatWhenANewSimpleParameterValueIsCreatedAndRequiredRdlIsNullThePossibleParameterTypesAreLoaded() { this.mrdl.RequiredRdl = null; this.parameterValue = new SimpleParameterValue(Guid.NewGuid(), this.cache, this.uri) { ParameterType = null }; this.session.Setup(x => x.RetrieveSiteDirectory()).Returns(this.siteDir); this.session.Setup(x => x.ActivePerson).Returns(new Person(Guid.NewGuid(), null, this.uri)); var vm = new SimpleParameterValueDialogViewModel(this.parameterValue.Clone(false), this.thingTransaction, this.session.Object, true, ThingDialogKind.Update, this.thingDialogNavigationService.Object, this.requirementClone); var parametertypes = new ReactiveList <ParameterType>(); CollectionAssert.AreEquivalent(parametertypes, vm.PossibleParameterType); }