public void VerifyThatGetPathWorks() { // **************************INPUT*************************************** var published = new ValueArray <string>(new List <string> { "manual1", "manual2" }, this.valueset); var actual = new ValueArray <string>(new List <string> { "manual1", "manual2" }, this.valueset); this.valueset.Published = published; this.valueset.Manual = actual; this.valueset.ValueSwitch = ParameterSwitchKind.MANUAL; this.valueset.ActualOption = this.option; var compoundtype = new CompoundParameterType(Guid.NewGuid(), null, this.uri); var component1 = new ParameterTypeComponent(Guid.NewGuid(), null, this.uri) { ParameterType = this.parameterType1, ShortName = "c1" }; var component2 = new ParameterTypeComponent(Guid.NewGuid(), null, this.uri) { ParameterType = this.parameterType1, ShortName = "c2" }; compoundtype.Component.Add(component1); compoundtype.Component.Add(component2); var state2 = new ActualFiniteState(Guid.NewGuid(), null, this.uri); this.stateList.ActualState.Add(state2); this.parameter1.ParameterType = compoundtype; this.parameter1.ValueSet.Add(this.valueset); this.parameter1.IsOptionDependent = true; var valueset2 = new ParameterValueSet(Guid.NewGuid(), null, this.uri) { ActualState = state2, Published = published }; this.parameter1.ValueSet.Add(valueset2); var row = new ParameterRowViewModel(this.parameter1, this.option, this.session.Object, null); Assert.AreEqual(this.nestedParameterPath, row.GetPath()); var row2 = new ParameterTypeComponentRowViewModel(compoundtype.Component.First(), this.session.Object, null); Assert.AreEqual(string.Empty, row2.GetPath()); var row3 = new ParameterTypeComponentRowViewModel(compoundtype.Component.First(), this.session.Object, row); Assert.AreEqual(this.nestedParameterPath, row3.GetPath()); }
public void VerifyThatPossibleParameterTypesArePopulatedCorrectly() { var transactionContext = TransactionContextResolver.ResolveContext(this.siteDir); var transaction = new ThingTransaction(transactionContext); var viewmodel = new CompoundParameterTypeDialogViewModel(this.compoundPt, transaction, this.session.Object, true, ThingDialogKind.Create, null); var parameterTypeComponent = new ParameterTypeComponentRowViewModel(this.parameterType, this.session.Object, viewmodel); Assert.True(parameterTypeComponent.PossibleParameterType.Count.Equals(2)); }
public void VerifyThatFilterSelectsCorrectPossibleParameterType() { var transactionContext = TransactionContextResolver.ResolveContext(this.siteDir); var transaction = new ThingTransaction(transactionContext); var viewmodel = new CompoundParameterTypeDialogViewModel(this.compoundPt, transaction, this.session.Object, true, ThingDialogKind.Create, null); var parameterTypeComponent = new ParameterTypeComponentRowViewModel(this.parameterType, this.session.Object, viewmodel); parameterTypeComponent.SelectedFilter = typeof(SimpleQuantityKind).Name; Assert.True(parameterTypeComponent.PossibleParameterType[0] is SimpleQuantityKind); }
public void VerifyThatPropertiesAreSet() { var transactionContext = TransactionContextResolver.ResolveContext(this.siteDir); var transaction = new ThingTransaction(transactionContext); var viewmodel = new CompoundParameterTypeDialogViewModel(this.compoundPt, transaction, this.session.Object, true, ThingDialogKind.Create, null); var parameterTypeComponent = new ParameterTypeComponentRowViewModel(this.parameterType, this.session.Object, viewmodel); Assert.False(parameterTypeComponent.IsReadOnly); Assert.Null(parameterTypeComponent.SelectedFilter); Assert.Null(parameterTypeComponent.Coordinates); Assert.AreEqual(parameterTypeComponent.PossibleParameterType.Count, 2); Assert.AreEqual(parameterTypeComponent.PossibleScale.Count, 0); }