public void VerifyThatStateDependentParameterOverrideValueSetReturnsExpectedModelCode() { var possibleFiniteStateList = new PossibleFiniteStateList(); var possibleFiniteState = new PossibleFiniteState(); possibleFiniteState.ShortName = "SM"; possibleFiniteStateList.PossibleState.Add(possibleFiniteState); var actualFiniteStateList = new ActualFiniteStateList(); actualFiniteStateList.PossibleFiniteStateList.Add(possibleFiniteStateList); var actualFiniteState = new ActualFiniteState(); actualFiniteState.PossibleState.Add(possibleFiniteState); actualFiniteStateList.ActualState.Add(actualFiniteState); this.scalarParameter.StateDependence = actualFiniteStateList; var parameterValueSet = this.scalarParameter.ValueSet.Single(); parameterValueSet.ActualState = actualFiniteState; var parameterOverride = new ParameterOverride(); parameterOverride.Parameter = this.scalarParameter; this.elementUsage.ParameterOverride.Add(parameterOverride); var parameterOverrideValueSet = new ParameterOverrideValueSet(); parameterOverrideValueSet.ParameterValueSet = parameterValueSet; parameterOverride.ValueSet.Add(parameterOverrideValueSet); parameterOverrideValueSet.ParameterValueSet = parameterValueSet; Assert.AreEqual(@"Sat.battery_1.l\SM", parameterOverrideValueSet.ModelCode(0)); }
public void VerifyNotChangedPossibleListAfterUpdateWorks() { var option2 = new Option(Guid.NewGuid(), 1); this.iteration.Option.Add(new OrderedItem { K = 2, V = option2.Iid.ToString() }); var guid = Guid.NewGuid(); this.asl1 = new ActualFiniteStateList(guid, 1); this.asl2 = new ActualFiniteStateList(guid, 1); var orderPossibleFiniteItem = new OrderedItem { K = 1, V = guid.ToString() }; this.asl1.PossibleFiniteStateList = new List <OrderedItem> { orderPossibleFiniteItem }; var orderPossibleFiniteOrigItem = new OrderedItem { K = 1, V = guid.ToString() }; this.asl2.PossibleFiniteStateList = new List <OrderedItem> { orderPossibleFiniteOrigItem }; //ActualFiniteStateList this.sideEffect.AfterUpdate(this.asl1, this.iteration, this.asl2, this.transaction, this.partition, this.securityContext.Object); this.finateTrategyLogicService.Verify(x => x.UpdateActualFinisteStateList(this.asl1, this.iteration, this.transaction, this.partition, this.securityContext.Object), Times.Never); }
public void VerifyThatTreeIsCorrectlyBuilt() { var possibleFiniteStateList = new PossibleFiniteStateList(Guid.NewGuid(), this.cache, this.uri); this.iteration.PossibleFiniteStateList.Add(possibleFiniteStateList); var possibleFiniteState = new PossibleFiniteState(Guid.NewGuid(), this.cache, this.uri); possibleFiniteStateList.PossibleState.Add(possibleFiniteState); var actualFiniteStateList = new ActualFiniteStateList(Guid.NewGuid(), this.cache, this.uri); actualFiniteStateList.PossibleFiniteStateList.Add(possibleFiniteStateList); this.iteration.ActualFiniteStateList.Add(actualFiniteStateList); var row = new ActualFiniteStateListRowViewModel(actualFiniteStateList, this.session.Object, null); Assert.IsEmpty(row.ContainedRows); var state = new ActualFiniteState(Guid.NewGuid(), this.cache, this.uri); state.PossibleState.Add(possibleFiniteState); actualFiniteStateList.ActualState.Add(state); this.rev.SetValue(actualFiniteStateList, 2); CDPMessageBus.Current.SendObjectChangeEvent(actualFiniteStateList, EventKind.Updated); var staterow = (ActualFiniteStateRowViewModel)row.ContainedRows.SingleOrDefault(); Assert.IsNotNull(staterow); }
public void Verify_that_ExecuteBatchUpdateParameterCommand_works_as_expected() { var possibleList = new PossibleFiniteStateList(Guid.NewGuid(), this.cache, this.uri); var ps = new PossibleFiniteState(Guid.NewGuid(), this.cache, this.uri); possibleList.PossibleState.Add(ps); this.iteration.PossibleFiniteStateList.Add(possibleList); var actualList = new ActualFiniteStateList(Guid.NewGuid(), this.cache, this.uri); actualList.PossibleFiniteStateList.Add(possibleList); var astate = new ActualFiniteState(Guid.NewGuid(), this.cache, this.uri); astate.PossibleState.Add(ps); actualList.ActualState.Add(astate); this.iteration.ActualFiniteStateList.Add(actualList); var dialogResult = new CDP4EngineeringModel.ViewModels.Dialogs.CategoryDomainParameterTypeSelectorResult(true, false, Enumerable.Empty <ParameterType>(), Enumerable.Empty <Category>(), Enumerable.Empty <DomainOfExpertise>()); this.dialogNavigationService.Setup(x => x.NavigateModal(It.IsAny <IDialogViewModel>())).Returns(dialogResult); var vm = new FiniteStateBrowserViewModel(this.iteration, this.session.Object, null, null, this.dialogNavigationService.Object, null, this.parameterActualFiniteStateListApplicationBatchService.Object); vm.SelectedThing = new ActualFiniteStateListRowViewModel(actualList, this.session.Object, null); vm.BatchUpdateParameterCommand.Execute(null); this.dialogNavigationService.Verify(x => x.NavigateModal(It.IsAny <IDialogViewModel>()), Times.Exactly(1)); this.parameterActualFiniteStateListApplicationBatchService.Verify(x => x.Update(this.session.Object, this.iteration, It.IsAny <ActualFiniteStateList>(), false, It.IsAny <IEnumerable <Category> >(), It.IsAny <IEnumerable <DomainOfExpertise> >(), It.IsAny <IEnumerable <ParameterType> >()), Times.Exactly(1)); }
public void Setup() { var ensurePackSchemeIsKnown = System.IO.Packaging.PackUriHelper.UriSchemePack; this.session = new Mock <ISession>(); this.cache = new ConcurrentDictionary <CacheKey, Lazy <Thing> >(); this.domain = new DomainOfExpertise(Guid.NewGuid(), this.cache, this.uri) { Name = "domain", ShortName = "dom" }; this.siteDirectory = new SiteDirectory(Guid.NewGuid(), this.cache, this.uri); this.model = new EngineeringModel(Guid.NewGuid(), this.cache, this.uri); this.modelSetup = new EngineeringModelSetup(Guid.NewGuid(), this.cache, this.uri); this.iteration = new Iteration(Guid.NewGuid(), this.cache, this.uri); this.iterationSetup = new IterationSetup(Guid.NewGuid(), this.cache, this.uri); this.person = new Person(Guid.NewGuid(), this.cache, this.uri) { GivenName = "test", Surname = "test" }; this.participant = new Participant(Guid.NewGuid(), this.cache, this.uri) { Person = this.person }; this.option = new Option(Guid.NewGuid(), this.cache, this.uri); this.elementdef1 = new ElementDefinition(Guid.NewGuid(), this.cache, this.uri); this.siteDirectory.Model.Add(this.modelSetup); this.modelSetup.IterationSetup.Add(this.iterationSetup); this.modelSetup.Participant.Add(this.participant); this.siteDirectory.Person.Add(this.person); this.model.Iteration.Add(this.iteration); this.model.EngineeringModelSetup = this.modelSetup; this.iteration.IterationSetup = this.iterationSetup; this.iteration.Option.Add(this.option); this.iteration.Element.Add(this.elementdef1); this.parameterType1 = new EnumerationParameterType(Guid.NewGuid(), this.cache, this.uri) { Name = "pt1" }; this.parameter1 = new Parameter(Guid.NewGuid(), this.cache, this.uri) { ParameterType = this.parameterType1, Owner = this.domain }; this.stateList = new ActualFiniteStateList(Guid.NewGuid(), this.cache, this.uri) { Owner = this.domain }; this.state1 = new ActualFiniteState(Guid.NewGuid(), this.cache, this.uri); this.valueset = new ParameterValueSet(Guid.NewGuid(), this.cache, this.uri); this.stateList.ActualState.Add(this.state1); this.elementdef1.Parameter.Add(this.parameter1); this.session.Setup(x => x.ActivePerson).Returns(this.person); this.session.Setup(x => x.OpenIterations).Returns(new Dictionary <Iteration, Tuple <DomainOfExpertise, Participant> >()); this.cache.TryAdd(new CacheKey(this.parameter1.Iid, null), new Lazy <Thing>(() => this.parameter1)); this.converter = new ProductTreeIconUriConverter(); }
public void VerifyThatOptionDependentStateDependentParameterValueSetReturnsExpectedModelCode() { var option = new Option(Guid.NewGuid(), null, null); option.ShortName = "option_1"; this.parameter.IsOptionDependent = true; this.parameterValueSet.ActualOption = option; var possibleFiniteStateList = new PossibleFiniteStateList(); var possibleFiniteState = new PossibleFiniteState(); possibleFiniteState.ShortName = "SM"; possibleFiniteStateList.PossibleState.Add(possibleFiniteState); var actualFiniteStateList = new ActualFiniteStateList(); actualFiniteStateList.PossibleFiniteStateList.Add(possibleFiniteStateList); var actualFiniteState = new ActualFiniteState(); actualFiniteState.PossibleState.Add(possibleFiniteState); actualFiniteStateList.ActualState.Add(actualFiniteState); this.parameter.StateDependence = actualFiniteStateList; this.parameterValueSet.ActualState = actualFiniteState; Assert.AreEqual(@"Sat.m\option_1\SM", this.parameterValueSet.ModelCode(0)); }
public void SetUp() { this.cache = new ConcurrentDictionary <CacheKey, Lazy <Thing> >(); this.possibleFiniteStateList_1 = new PossibleFiniteStateList(Guid.NewGuid(), this.cache, this.uri); this.possibleFiniteState_1_1 = new PossibleFiniteState(Guid.NewGuid(), this.cache, this.uri); this.possibleFiniteState_1_2 = new PossibleFiniteState(Guid.NewGuid(), this.cache, this.uri); this.possibleFiniteStateList_1.PossibleState.Add(this.possibleFiniteState_1_1); this.possibleFiniteStateList_1.PossibleState.Add(this.possibleFiniteState_1_2); this.possibleFiniteStateList_2 = new PossibleFiniteStateList(Guid.NewGuid(), this.cache, this.uri); this.possibleFiniteState_2_1 = new PossibleFiniteState(Guid.NewGuid(), this.cache, this.uri); this.possibleFiniteState_2_2 = new PossibleFiniteState(Guid.NewGuid(), this.cache, this.uri); this.possibleFiniteStateList_2.PossibleState.Add(this.possibleFiniteState_2_1); this.possibleFiniteStateList_2.PossibleState.Add(this.possibleFiniteState_2_2); this.actualFiniteStateList = new ActualFiniteStateList(Guid.NewGuid(), this.cache, this.uri); this.actualFiniteStateList.PossibleFiniteStateList.Insert(1, this.possibleFiniteStateList_1); this.actualFiniteState_1 = new ActualFiniteState(Guid.NewGuid(), this.cache, this.uri); this.actualFiniteState_1.PossibleState.Add(this.possibleFiniteState_1_1); this.actualFiniteState_2 = new ActualFiniteState(Guid.NewGuid(), this.cache, this.uri); this.actualFiniteState_2.PossibleState.Add(this.possibleFiniteState_1_2); this.actualFiniteState_3 = new ActualFiniteState(Guid.NewGuid(), this.cache, this.uri); this.actualFiniteState_3.PossibleState.Add(this.possibleFiniteState_2_1); this.actualFiniteState_4 = new ActualFiniteState(Guid.NewGuid(), this.cache, this.uri); this.actualFiniteState_4.PossibleState.Add(this.possibleFiniteState_2_2); this.actualFiniteStateList.ActualState.Add(this.actualFiniteState_1); this.actualFiniteStateList.ActualState.Add(this.actualFiniteState_2); this.actualFiniteStateList.ActualState.Add(this.actualFiniteState_3); this.actualFiniteStateList.ActualState.Add(this.actualFiniteState_4); this.comparer = new ActualFiniteStateComparer(); }
/// <summary> /// Compute the sort key of a <see cref="ActualFiniteState"/> based on the <see cref="ActualFiniteState.PossibleState"/> property /// </summary> /// <param name="actualState">The <see cref="ActualFiniteState"/></param> /// <param name="actualList">The <see cref="ActualFiniteStateList"/> container</param> /// <returns>The sort-key</returns> private int GetComputedSortKey(ActualFiniteState actualState, ActualFiniteStateList actualList) { // The OCDT WSP may return a broken model where the actualState.PossibleState is empty. if (actualState.PossibleState.Count == 0) { return(Int32.MaxValue); } var possibleFiniteStateListsSize = actualList.PossibleFiniteStateList.SortedItems.Values.Select(x => x.PossibleState.Count).ToList(); var orderKey = 0; foreach (var possibleState in actualState.PossibleState) { var power = 1; var containerPossibleFiniteStateList = (PossibleFiniteStateList)possibleState.Container; var position = containerPossibleFiniteStateList.PossibleState.IndexOf(possibleState); for (var i = actualList.PossibleFiniteStateList.IndexOf(containerPossibleFiniteStateList) + 1; i < possibleFiniteStateListsSize.Count; i++) { power = power * possibleFiniteStateListsSize[i]; } orderKey += power * position; } return(orderKey); }
/// <summary> /// Initializes a new instance of the <see cref="ActualFiniteStateListDialogViewModel"/> class /// </summary> /// <param name="actualFiniteStateList"> /// The <see cref="ActualFiniteStateList"/> that is the subject of the current view-model. This is the object /// that will be either created, or edited. /// </param> /// <param name="transaction"> /// The <see cref="ThingTransaction"/> that contains the log of recorded changes. /// </param> /// <param name="session"> /// The <see cref="ISession"/> in which the current <see cref="Thing"/> is to be added or updated /// </param> /// <param name="isRoot"> /// Assert if this <see cref="DialogViewModelBase{T}"/> is the root of all <see cref="DialogViewModelBase{T}"/> /// </param> /// <param name="dialogKind"> /// The kind of operation this <see cref="DialogViewModelBase{T}"/> performs /// </param> /// <param name="thingDialogNavigationService"> /// The <see cref="IThingDialogNavigationService"/> that is used to navigate to a dialog of a specific <see cref="Thing"/>. /// </param> /// <param name="container">The Container <see cref="Thing"/> of the created <see cref="MultiRelationshipRule"/></param> /// <param name="chainOfContainers"> /// The optional chain of containers that contains the <paramref name="container"/> argument /// </param> public ActualFiniteStateListDialogViewModel(ActualFiniteStateList actualFiniteStateList, IThingTransaction transaction, ISession session, bool isRoot, ThingDialogKind dialogKind, IThingDialogNavigationService thingDialogNavigationService, Thing container = null, IEnumerable <Thing> chainOfContainers = null) : base(actualFiniteStateList, transaction, session, isRoot, dialogKind, thingDialogNavigationService, container, chainOfContainers) { // called last during construction this.WhenAnyValue(vm => vm.IncludeOption) .Subscribe( _ => this.ExcludeOption = new ReactiveList <Option>(this.PossibleExcludeOption.Except(this.IncludeOption))); }
public void Verify_that_when_containers_are_not_the_same_exception_is_thrown() { var otherActualFiniteStateList = new ActualFiniteStateList(Guid.NewGuid(), this.cache, this.uri); var otherActualFiniteState = new ActualFiniteState(Guid.NewGuid(), this.cache, this.uri); otherActualFiniteStateList.ActualState.Add(otherActualFiniteState); Assert.Throws <InvalidOperationException>(() => this.comparer.Compare(this.actualFiniteState_1, otherActualFiniteState)); }
/// <summary> /// Create default state-dependent <see cref="ParameterValueSet"/> /// </summary> /// <param name="actualFiniteStateList"> /// The <see cref="ActualFiniteStateList"/> /// </param> /// <param name="actualOption"> /// The actual option /// </param> /// <param name="defaultValueArray"> /// The default Value Array. /// </param> /// <returns> /// The <see cref="IEnumerable{ParameterValueSet}"/>. /// </returns> private IEnumerable <ParameterValueSet> CreateDefaultStateDependentValueSetCollection( ActualFiniteStateList actualFiniteStateList, Guid?actualOption, ValueArray <string> defaultValueArray) { foreach (var state in actualFiniteStateList.ActualState) { yield return(this.CreateDefaultParameterValueSet(actualOption, state, defaultValueArray)); } }
/// <summary> /// Create default state-dependent <see cref="ParameterValueSet"/> /// </summary> /// <param name="actualFiniteStateList"> /// The <see cref="ActualFiniteStateList"/> /// </param> /// <param name="actualOption"> /// The actual option /// </param> /// <param name="defaultValueArray"> /// The default Value Array. /// </param> /// <returns> /// The <see cref="IEnumerable{ParameterValueSet}"/>. /// </returns> private IEnumerable <ParameterValueSet> CreateDefaultStateDependentValueSetCollection( ActualFiniteStateList actualFiniteStateList, Guid?actualOption, ValueArray <string> defaultValueArray) { foreach (var state in actualFiniteStateList.ActualState) { // try to find a value-set in the old sets that matches the specified state, else just take the fi var sourceValueSet = this.OldParameterContextProvider.GetsourceValueSet(actualOption, state); yield return(this.ParameterValueSetFactory.CreateNewParameterValueSetFromSource(actualOption, state, sourceValueSet, defaultValueArray)); } }
public void VerifyThatContainerSetToClone() { var list = new ActualFiniteStateList(); var state = new ActualFiniteState(); list.ActualState.Add(state); var clone = list.Clone(false); Assert.AreSame(list, state.Container); clone.ActualState.Clear(); clone.ActualState.Add(state); Assert.AreSame(clone, state.Container); }
/// <summary> /// Updates multiple <see cref="Parameter"/>s with <see cref="ActualFiniteStateList"/> application in one batch operation /// </summary> /// <param name="session"> /// The <see cref="ISession"/> that is used to communicate with the selected data source /// </param> /// <param name="iteration"> /// The container <see cref="Iteration"/> in which the parameteres are to be updated /// </param> /// <param name="actualFiniteStateList"> /// The <see cref="ActualFiniteStateList"/> that needs to be applied to the <see cref="Parameter"/>s /// </param> /// <param name="isUncategorizedIncluded"> /// A value indication whether <see cref="Parameter"/>s contained by <see cref="ElementDefinition"/>s that are /// not a member of a <see cref="Category"/> shall be included or not /// </param> /// <param name="categories"> /// An <see cref="IEnumerable{Category}"/> that is a selection criteria to select the <see cref="Parameter"/>s that need /// to be updated with the <see cref="ActualFiniteStateList"/> /// </param> /// <param name="domainOfExpertises"></param> /// An <see cref="IEnumerable{DomainOfExpertise}"/> that is a selection criteria to select the <see cref="Parameter"/>s that need /// to be updated with the <see cref="ActualFiniteStateList"/> /// <param name="parameterTypes"> /// An <see cref="IEnumerable{ParameterType}"/> that is a selection criteria to select the <see cref="Parameter"/>s that need /// to be updated with the <see cref="ActualFiniteStateList"/> /// </param> /// <returns> /// an awaitable <see cref="Task"/> /// </returns> public async Task Update(ISession session, Iteration iteration, ActualFiniteStateList actualFiniteStateList, bool isUncategorizedIncluded, IEnumerable <Category> categories, IEnumerable <DomainOfExpertise> domainOfExpertises, IEnumerable <ParameterType> parameterTypes) { if (session == null) { throw new ArgumentNullException(nameof(session), $"The {nameof(session)} may not be null"); } if (iteration == null) { throw new ArgumentNullException(nameof(iteration), $"The {nameof(iteration)} may not be null"); } if (actualFiniteStateList == null) { throw new ArgumentNullException(nameof(actualFiniteStateList), $"The {nameof(actualFiniteStateList)} may not be null"); } if (categories == null) { throw new ArgumentNullException(nameof(categories), $"The {nameof(categories)} may not be null"); } if (domainOfExpertises == null) { throw new ArgumentNullException(nameof(domainOfExpertises), $"The {nameof(domainOfExpertises)} may not be null"); } if (parameterTypes == null) { throw new ArgumentNullException(nameof(parameterTypes), $"The {nameof(parameterTypes)} may not be null"); } var parameters = this.QueryParameters(session, iteration, actualFiniteStateList, isUncategorizedIncluded, categories, domainOfExpertises, parameterTypes); if (!parameters.Any()) { return; } var transactionContext = TransactionContextResolver.ResolveContext(iteration); var transaction = new ThingTransaction(transactionContext); this.UpdateTransactionWithUpdatedParameters(transaction, actualFiniteStateList, parameters); var updateOperationContainer = transaction.FinalizeTransaction(); await session.Write(updateOperationContainer); }
/// <summary> /// Gets the default <see cref="ActualFiniteState"/> for <paramref name="actualList"/> /// </summary> /// <param name="actualList">The <see cref="ActualFiniteStateList"/> to get the default for</param> /// <param name="actualListStates">A list of <see cref="ActualFiniteState"/> defining the <paramref name="actualList"/></param> /// <param name="possibleLists">A list of <see cref="PossibleFiniteStateList"/> defining the <paramref name="actualList"/></param> /// <returns>The default <see cref="ActualFiniteState"/> if any, null otherwise</returns> public ActualFiniteState GetDefaultState(ActualFiniteStateList actualList, IReadOnlyList <ActualFiniteState> actualListStates, IReadOnlyList <PossibleFiniteStateList> possibleLists) { if (actualList == null) { throw new ArgumentNullException(nameof(actualList)); } if (actualListStates == null) { throw new ArgumentNullException(nameof(actualListStates)); } if (!actualList.ActualState.TrueForAll(x => actualListStates.Select(s => s.Iid).Contains(x))) { throw new ArgumentException("Some Actual Finite States are missing.", nameof(actualListStates)); } if (possibleLists == null) { throw new ArgumentNullException(nameof(possibleLists)); } if (!actualList.PossibleFiniteStateList.TrueForAll(x => possibleLists.Select(s => s.Iid).Contains(Guid.Parse(x.V.ToString())))) { throw new ArgumentException("Some Actual Finite States are missing.", nameof(possibleLists)); } // get all default states from the possibleList combination making up the ActualList var actualPossibleLists = possibleLists.Where(p => actualList.PossibleFiniteStateList.Select(x => Guid.Parse(x.V.ToString())).Contains(p.Iid)).ToList(); var defaultPossibleStates = new List <Guid>(); foreach (var possibleFiniteStateList in actualPossibleLists) { if (!possibleFiniteStateList.DefaultState.HasValue) { // no default ActualState if at least one has no default state return(null); } defaultPossibleStates.Add(possibleFiniteStateList.DefaultState.Value); } var actualActualListStates = actualListStates.Where(a => actualList.ActualState.Contains(a.Iid)); return(actualActualListStates.FirstOrDefault(a => a.PossibleState.TrueForAll(x => defaultPossibleStates.Contains(x)))); }
public void VerifyThatContextMenuPopulated() { this.permissionService.Setup(x => x.CanWrite(It.IsAny <ClassKind>(), It.IsAny <Thing>())).Returns(true); this.permissionService.Setup(x => x.CanWrite(It.IsAny <Thing>())).Returns(true); var possibleList = new PossibleFiniteStateList(Guid.NewGuid(), this.cache, this.uri); var ps = new PossibleFiniteState(Guid.NewGuid(), this.cache, this.uri); possibleList.PossibleState.Add(ps); this.iteration.PossibleFiniteStateList.Add(possibleList); var actualList = new ActualFiniteStateList(Guid.NewGuid(), this.cache, this.uri); actualList.PossibleFiniteStateList.Add(possibleList); var astate = new ActualFiniteState(Guid.NewGuid(), this.cache, this.uri); astate.PossibleState.Add(ps); actualList.ActualState.Add(astate); this.iteration.ActualFiniteStateList.Add(actualList); var viewmodel = new FiniteStateBrowserViewModel(this.iteration, this.session.Object, this.thingDialogNavigationService.Object, this.panelNavigationService.Object, null, null); // no row selected viewmodel.ComputePermission(); viewmodel.PopulateContextMenu(); Assert.AreEqual(2, viewmodel.ContextMenu.Count); // posible state row selected var pslFolder = viewmodel.FiniteStateList.First(); var psRow = pslFolder.ContainedRows.First().ContainedRows.First(); viewmodel.SelectedThing = psRow; viewmodel.ComputePermission(); viewmodel.PopulateContextMenu(); Assert.AreEqual(8, viewmodel.ContextMenu.Count); // execute set default Assert.IsTrue(viewmodel.CanSetAsDefault); viewmodel.SetDefaultStateCommand.Execute(null); this.session.Verify(x => x.Write(It.IsAny <OperationContainer>())); }
/// <summary> /// Serialize the <see cref="ActualFiniteStateList"/> /// </summary> /// <param name="actualFiniteStateList">The <see cref="ActualFiniteStateList"/> to serialize</param> /// <returns>The <see cref="JObject"/></returns> private JObject Serialize(ActualFiniteStateList actualFiniteStateList) { var jsonObject = new JObject(); jsonObject.Add("actualState", this.PropertySerializerMap["actualState"](actualFiniteStateList.ActualState.OrderBy(x => x, this.guidComparer))); jsonObject.Add("classKind", this.PropertySerializerMap["classKind"](Enum.GetName(typeof(CDP4Common.CommonData.ClassKind), actualFiniteStateList.ClassKind))); jsonObject.Add("excludedDomain", this.PropertySerializerMap["excludedDomain"](actualFiniteStateList.ExcludedDomain.OrderBy(x => x, this.guidComparer))); jsonObject.Add("excludedPerson", this.PropertySerializerMap["excludedPerson"](actualFiniteStateList.ExcludedPerson.OrderBy(x => x, this.guidComparer))); jsonObject.Add("excludeOption", this.PropertySerializerMap["excludeOption"](actualFiniteStateList.ExcludeOption.OrderBy(x => x, this.guidComparer))); jsonObject.Add("iid", this.PropertySerializerMap["iid"](actualFiniteStateList.Iid)); jsonObject.Add("modifiedOn", this.PropertySerializerMap["modifiedOn"](actualFiniteStateList.ModifiedOn)); jsonObject.Add("owner", this.PropertySerializerMap["owner"](actualFiniteStateList.Owner)); jsonObject.Add("possibleFiniteStateList", this.PropertySerializerMap["possibleFiniteStateList"](actualFiniteStateList.PossibleFiniteStateList.OrderBy(x => x, this.orderedItemComparer))); jsonObject.Add("revisionNumber", this.PropertySerializerMap["revisionNumber"](actualFiniteStateList.RevisionNumber)); jsonObject.Add("thingPreference", this.PropertySerializerMap["thingPreference"](actualFiniteStateList.ThingPreference)); return(jsonObject); }
public void VerifyThatTreeIsBuiltCorrectly() { var viewmodel = new FiniteStateBrowserViewModel(this.iteration, this.session.Object, this.thingDialogNavigationService.Object, this.panelNavigationService.Object, null, null, null); Assert.IsNotEmpty(viewmodel.FiniteStateList); var possibleList = new PossibleFiniteStateList(Guid.NewGuid(), this.cache, this.uri); this.iteration.PossibleFiniteStateList.Add(possibleList); this.rev.SetValue(this.iteration, 1); CDPMessageBus.Current.SendObjectChangeEvent(this.iteration, EventKind.Updated); var possibleListRow = viewmodel.FiniteStateList.FirstOrDefault(); Assert.IsNotNull(possibleListRow); Assert.IsTrue(possibleListRow.ContainedRows.Select(x => x.Thing).Contains(possibleList)); this.iteration.PossibleFiniteStateList.Clear(); this.rev.SetValue(this.iteration, 2); CDPMessageBus.Current.SendObjectChangeEvent(this.iteration, EventKind.Updated); Assert.IsNotEmpty(viewmodel.FiniteStateList); var actualList = new ActualFiniteStateList(Guid.NewGuid(), this.cache, this.uri); this.rev.SetValue(this.iteration, 3); this.iteration.ActualFiniteStateList.Add(actualList); CDPMessageBus.Current.SendObjectChangeEvent(this.iteration, EventKind.Updated); var actualListRow = viewmodel.FiniteStateList.Last(); Assert.IsNotNull(actualListRow); Assert.IsNotEmpty(actualListRow.ContainedRows); this.iteration.PossibleFiniteStateList.Add(possibleList); this.iteration.ActualFiniteStateList.Remove(actualList); this.rev.SetValue(this.iteration, 4); CDPMessageBus.Current.SendObjectChangeEvent(this.iteration, EventKind.Updated); Assert.AreEqual(2, viewmodel.FiniteStateList.Count); Assert.AreSame(possibleListRow, viewmodel.FiniteStateList.First()); }
public void SetUp() { this.uri = new Uri("http://www.rheagroup.com"); this.cache = new ConcurrentDictionary <CDP4Common.Types.CacheKey, Lazy <Thing> >(); this.siteReferenceDataLibrary = new SiteReferenceDataLibrary(Guid.NewGuid(), this.cache, this.uri); this.powerEngineering = new DomainOfExpertise(Guid.NewGuid(), this.cache, this.uri); this.simpleQuantityKind = new SimpleQuantityKind(Guid.NewGuid(), this.cache, this.uri); this.equipments = new Category(Guid.NewGuid(), this.cache, this.uri) { ShortName = "EQT", Name = "Equipments" }; this.siteReferenceDataLibrary.DefinedCategory.Add(this.equipments); var engineeringModel = new EngineeringModel(Guid.NewGuid(), this.cache, this.uri); this.iteration = new Iteration(Guid.NewGuid(), this.cache, this.uri); engineeringModel.Iteration.Add(this.iteration); var elementDefinition = new ElementDefinition(Guid.NewGuid(), this.cache, this.uri) { Owner = this.powerEngineering }; elementDefinition.Category.Add(this.equipments); this.iteration.Element.Add(elementDefinition); var parameter = new Parameter(Guid.NewGuid(), this.cache, this.uri) { Owner = this.powerEngineering, ParameterType = this.simpleQuantityKind }; elementDefinition.Parameter.Add(parameter); this.actualFiniteStateList = new ActualFiniteStateList(Guid.NewGuid(), this.cache, this.uri); this.iteration.ActualFiniteStateList.Add(this.actualFiniteStateList); this.session = new Mock <ISession>(); this.permissionService = new Mock <IPermissionService>(); this.session.Setup(x => x.PermissionService).Returns(this.permissionService.Object); this.permissionService.Setup(x => x.CanWrite(It.IsAny <Parameter>())).Returns(true); this.parameterActualFiniteStateListApplicationBatchService = new ParameterActualFiniteStateListApplicationBatchService(); }
private Parameter AddStateDependentParameter( ElementDefinition elementDefinition, ParameterType parameterType, DomainOfExpertise owner, ActualFiniteStateList actualFiniteStateList, string value) { var parameter = new Parameter(Guid.NewGuid(), this.cache, null) { ParameterType = parameterType, Owner = owner, Scale = this.scale }; foreach (var state in actualFiniteStateList.ActualState) { var valueSet = new ParameterValueSet(Guid.NewGuid(), this.cache, null) { ActualState = state, Published = new ValueArray <string>(new List <string> { value }), Manual = new ValueArray <string>(new List <string> { value }), Computed = new ValueArray <string>(new List <string> { value }), Formula = new ValueArray <string>(new List <string> { value }), ValueSwitch = ParameterSwitchKind.MANUAL }; parameter.ValueSet.Add(valueSet); } elementDefinition.Parameter.Add(parameter); return(parameter); }
public void VerifyThatStateDependentParameterValueSetReturnsExpectedModelCode() { var possibleFiniteStateList = new PossibleFiniteStateList(); var possibleFiniteState = new PossibleFiniteState(); possibleFiniteState.ShortName = "SM"; possibleFiniteStateList.PossibleState.Add(possibleFiniteState); var actualFiniteStateList = new ActualFiniteStateList(); actualFiniteStateList.PossibleFiniteStateList.Add(possibleFiniteStateList); var actualFiniteState = new ActualFiniteState(); actualFiniteState.PossibleState.Add(possibleFiniteState); actualFiniteStateList.ActualState.Add(actualFiniteState); this.parameter.StateDependence = actualFiniteStateList; this.parameterValueSet.ActualState = actualFiniteState; Assert.AreEqual(@"Sat.m\SM", this.parameterValueSet.ModelCode(0)); }
public void SetUp() { this.iteration = new Iteration(Guid.NewGuid(), null, null); this.optiona = new Option(Guid.NewGuid(), null, null) { Name = "option a", ShortName = "optionb" }; this.optionb = new Option(Guid.NewGuid(), null, null) { Name = "option b", ShortName = "optionb" }; this.iteration.Option.Add(this.optionb); this.iteration.Option.Add(this.optiona); var possibleFiniteStateList = new PossibleFiniteStateList(Guid.NewGuid(), null, null); var possibleFiniteStatea = new PossibleFiniteState(Guid.NewGuid(), null, null) { Name = "state a", ShortName = "statea" }; var possibleFiniteStateb = new PossibleFiniteState(Guid.NewGuid(), null, null) { Name = "state b", ShortName = "stateb" }; possibleFiniteStateList.PossibleState.Add(possibleFiniteStateb); possibleFiniteStateList.PossibleState.Add(possibleFiniteStatea); this.iteration.PossibleFiniteStateList.Add(possibleFiniteStateList); var actualFiniteStateList = new ActualFiniteStateList(Guid.NewGuid(), null, null); this.actualFiniteStatea = new ActualFiniteState(Guid.NewGuid(), null, null); this.actualFiniteStatea.PossibleState.Add(possibleFiniteStatea); this.actualFiniteStateb = new ActualFiniteState(Guid.NewGuid(), null, null); this.actualFiniteStateb.PossibleState.Add(possibleFiniteStateb); actualFiniteStateList.ActualState.Add(this.actualFiniteStateb); actualFiniteStateList.ActualState.Add(this.actualFiniteStatea); this.iteration.ActualFiniteStateList.Add(actualFiniteStateList); }
public void VerifyThatPropertiesAreSet() { var statelist = new ActualFiniteStateList(); var containerClone = this.iteration.Clone(false); var transactionContext = TransactionContextResolver.ResolveContext(this.iteration); var transaction = new ThingTransaction(transactionContext, containerClone); var vm = new ActualFiniteStateListDialogViewModel(statelist, transaction, this.session.Object, true, ThingDialogKind.Create, this.thingDialogNavigationService.Object, containerClone); Assert.IsFalse(vm.OkCanExecute); Assert.AreEqual(3, vm.PossibleOwner.Count); Assert.That(vm.PossibleOwner, Is.Ordered.By(nameof(DomainOfExpertise.Name))); Assert.That(this.possibleOwners, Is.Not.Ordered.By(nameof(DomainOfExpertise.Name))); Assert.AreEqual(0, vm.PossibleFiniteStateListRow.Count); Assert.AreEqual(0, vm.ActualState.Count); Assert.IsTrue(vm.AddPossibleFiniteStateListCommand.CanExecute(null)); vm.AddPossibleFiniteStateListCommand.Execute(null); Assert.AreEqual(1, vm.PossibleFiniteStateListRow.Count); var pfsl1 = vm.PossibleFiniteStateListRow.First(); Assert.AreEqual(2, pfsl1.PossiblePossibleFiniteStateList.Count); Assert.IsTrue(vm.AddPossibleFiniteStateListCommand.CanExecute(null)); vm.AddPossibleFiniteStateListCommand.Execute(null); Assert.AreEqual(2, vm.PossibleFiniteStateListRow.Count); var pfsl2 = vm.PossibleFiniteStateListRow.Last(); Assert.AreEqual(1, pfsl2.PossiblePossibleFiniteStateList.Count); Assert.AreEqual(1, pfsl1.PossiblePossibleFiniteStateList.Count); vm.SelectedOwner = vm.PossibleOwner.First(); Assert.IsTrue(vm.OkCanExecute); }
public void VerifyThatDeepCloneWorksWithActualFiniteStateList() { var actualList = new ActualFiniteStateList(Guid.NewGuid(), 0); var item = new OrderedItem { K = 1, V = Guid.NewGuid() }; actualList.PossibleFiniteStateList.Add(item); actualList.ActualState.Add(Guid.NewGuid()); var clone = actualList.DeepClone <ActualFiniteStateList>(); Assert.That(clone.PossibleFiniteStateList.Count, Is.EqualTo(1)); Assert.That(clone.ActualState.Count, Is.EqualTo(1)); clone.ActualState.Add(Guid.NewGuid()); Assert.That(actualList.ActualState.Count, Is.EqualTo(1)); var ordereditem = clone.PossibleFiniteStateList.Single(); Assert.That(ordereditem.K, Is.EqualTo(1)); Assert.That(ordereditem.V, Is.EqualTo(item.V)); }
public void Setup() { this.actualFiniteState = new ActualFiniteState(Guid.NewGuid(), null, null); this.actualList = new ActualFiniteStateList(Guid.NewGuid(), null, null); this.actualList.Owner = new DomainOfExpertise(Guid.NewGuid(), null, null); this.possibleList1 = new PossibleFiniteStateList(Guid.NewGuid(), null, null); this.possibleList2 = new PossibleFiniteStateList(Guid.NewGuid(), null, null); this.possibleState1 = new PossibleFiniteState(Guid.NewGuid(), null, null) { Name = "possiblestate1", ShortName = "1" }; this.possibleState2 = new PossibleFiniteState(Guid.NewGuid(), null, null) { Name = "possiblestate2", ShortName = "2" }; this.possibleList1.PossibleState.Add(this.possibleState1); this.possibleList2.PossibleState.Add(this.possibleState2); this.actualFiniteState.PossibleState.Add(this.possibleState1); this.actualFiniteState.PossibleState.Add(this.possibleState2); this.actualList.PossibleFiniteStateList.Add(this.possibleList1); this.actualList.PossibleFiniteStateList.Add(this.possibleList2); this.iteration = new Iteration(Guid.NewGuid(), null, null); this.model = new EngineeringModel(Guid.NewGuid(), null, null); this.model.Iteration.Add(this.iteration); this.iteration.ActualFiniteStateList.Add(this.actualList); this.iteration.PossibleFiniteStateList.Add(this.possibleList1); this.iteration.PossibleFiniteStateList.Add(this.possibleList2); this.actualList.ActualState.Add(this.actualFiniteState); }
/// <summary> /// Initializes a new instance of the <see cref="ActualFiniteStateListRowViewModel"/> class /// </summary> /// <param name="actualFiniteStateList">The <see cref="ActualFiniteStateList"/></param> /// <param name="session">The <see cref="ISession"/></param> /// <param name="containerViewModel">The container <see cref="IViewModelBase{T}"/></param> public ActualFiniteStateListRowViewModel(ActualFiniteStateList actualFiniteStateList, ISession session, IViewModelBase <Thing> containerViewModel) : base(actualFiniteStateList, session, containerViewModel) { this.UpdateProperties(); }
public void Setup() { this.permissionService = new Mock <IPermissionService>(); this.permissionService.Setup(x => x.CanWrite(It.IsAny <ClassKind>(), It.IsAny <Thing>())).Returns(true); this.thingDialognavigationService = new Mock <IThingDialogNavigationService>(); this.session = new Mock <ISession>(); this.session.Setup(x => x.PermissionService).Returns(this.permissionService.Object); this.stateList = new ActualFiniteStateList(Guid.NewGuid(), null, this.uri); this.state1 = new PossibleFiniteState(Guid.NewGuid(), null, this.uri) { Name = "state1" }; this.state2 = new PossibleFiniteState(Guid.NewGuid(), null, this.uri) { Name = "state2" }; this.posStateList = new PossibleFiniteStateList(Guid.NewGuid(), null, this.uri); this.posStateList.PossibleState.Add(this.state1); this.posStateList.PossibleState.Add(this.state2); this.posStateList.DefaultState = this.state1; this.actualState1 = new ActualFiniteState(Guid.NewGuid(), null, this.uri) { PossibleState = new List <PossibleFiniteState> { this.state1 }, Kind = ActualFiniteStateKind.MANDATORY }; this.actualState2 = new ActualFiniteState(Guid.NewGuid(), null, this.uri) { PossibleState = new List <PossibleFiniteState> { this.state2 }, Kind = ActualFiniteStateKind.MANDATORY }; this.stateList.ActualState.Add(this.actualState1); this.stateList.ActualState.Add(this.actualState2); this.stateList.PossibleFiniteStateList.Add(this.posStateList); this.option1 = new Option(Guid.NewGuid(), null, this.uri) { Name = "option1" }; this.option2 = new Option(Guid.NewGuid(), null, this.uri) { Name = "option2" }; this.qqParamType = new SimpleQuantityKind(Guid.NewGuid(), null, this.uri) { Name = "PTName", ShortName = "PTShortName" }; this.enum1 = new EnumerationValueDefinition(Guid.NewGuid(), null, this.uri) { Name = "enum1" }; this.enum2 = new EnumerationValueDefinition(Guid.NewGuid(), null, this.uri) { Name = "enum2" }; this.enumPt = new EnumerationParameterType(Guid.NewGuid(), null, this.uri); this.enumPt.ValueDefinition.Add(this.enum1); this.enumPt.ValueDefinition.Add(this.enum2); this.cptType = new CompoundParameterType(Guid.NewGuid(), null, this.uri) { Name = "APTName", ShortName = "APTShortName" }; this.cptType.Component.Add(new ParameterTypeComponent(Guid.NewGuid(), null, this.uri) { Iid = Guid.NewGuid(), ParameterType = this.qqParamType, ShortName = "c1" }); this.cptType.Component.Add(new ParameterTypeComponent(Guid.NewGuid(), null, this.uri) { Iid = Guid.NewGuid(), ParameterType = this.enumPt, ShortName = "c2" }); this.activeDomain = new DomainOfExpertise(Guid.NewGuid(), null, this.uri) { Name = "active", ShortName = "active" }; this.someotherDomain = new DomainOfExpertise(Guid.NewGuid(), null, this.uri) { Name = "other", ShortName = "other" }; this.parameter = new Parameter(Guid.NewGuid(), null, this.uri) { Owner = this.activeDomain, ParameterType = this.qqParamType }; this.cptParameter = new Parameter(Guid.NewGuid(), null, this.uri) { Owner = this.activeDomain, ParameterType = this.cptType, IsOptionDependent = true, StateDependence = this.stateList }; this.cptParameter.ValueSet.Add(this.GetNewParameterValueSet(this.option1, this.stateList.ActualState.First())); this.cptParameter.ValueSet.Add(this.GetNewParameterValueSet(this.option1, this.stateList.ActualState.Last())); this.cptParameter.ValueSet.Add(this.GetNewParameterValueSet(this.option2, this.stateList.ActualState.First())); this.cptParameter.ValueSet.Add(this.GetNewParameterValueSet(this.option2, this.stateList.ActualState.Last())); this.elementDefinition = new ElementDefinition(Guid.NewGuid(), null, this.uri) { Owner = this.activeDomain }; this.elementDefinitionForUsage1 = new ElementDefinition(Guid.NewGuid(), null, this.uri); this.elementUsage1 = new ElementUsage(Guid.NewGuid(), null, this.uri) { ElementDefinition = this.elementDefinitionForUsage1 }; this.elementDefinition.ContainedElement.Add(this.elementUsage1); this.elementDefinitionForUsage1.Parameter.Add(this.parameter); this.elementDefinitionForUsage1.Parameter.Add(this.cptParameter); this.iteration = new Iteration(Guid.NewGuid(), null, this.uri); this.iteration.Element.Add(this.elementDefinition); this.iteration.Element.Add(this.elementDefinitionForUsage1); this.iteration.Option.Add(this.option1); this.iteration.Option.Add(this.option2); this.model = new EngineeringModel(Guid.NewGuid(), null, this.uri); this.model.Iteration.Add(this.iteration); this.person = new Person(Guid.NewGuid(), null, this.uri) { GivenName = "test", Surname = "test" }; this.participant = new Participant(Guid.NewGuid(), null, this.uri) { Person = this.person, SelectedDomain = this.activeDomain }; this.session.Setup(x => x.ActivePerson).Returns(this.person); this.modelsetup = new EngineeringModelSetup(Guid.NewGuid(), null, this.uri); this.modelsetup.Participant.Add(this.participant); this.model.EngineeringModelSetup = this.modelsetup; this.session.Setup(x => x.PermissionService).Returns(this.permissionService.Object); this.permissionService.Setup(x => x.CanWrite(It.IsAny <Thing>())).Returns(true); this.assembler = new Assembler(this.uri); this.session.Setup(x => x.Assembler).Returns(this.assembler); this.session.Setup(x => x.OpenIterations).Returns(new Dictionary <Iteration, Tuple <DomainOfExpertise, Participant> >()); }
public void SetUp() { this.permissionService = new Mock <IPermissionService>(); this.obfuscationService = new Mock <IObfuscationService>(); this.session = new Mock <ISession>(); this.assembler = new Assembler(this.uri); this.session.Setup(x => x.PermissionService).Returns(this.permissionService.Object); this.option1 = new Option(Guid.NewGuid(), this.assembler.Cache, this.uri) { ShortName = "1" }; this.option2 = new Option(Guid.NewGuid(), this.assembler.Cache, this.uri) { ShortName = "2" }; this.stateList = new ActualFiniteStateList(Guid.NewGuid(), this.assembler.Cache, this.uri); this.state1 = new PossibleFiniteState(Guid.NewGuid(), this.assembler.Cache, this.uri); this.state2 = new PossibleFiniteState(Guid.NewGuid(), this.assembler.Cache, this.uri); this.posStateList = new PossibleFiniteStateList(Guid.NewGuid(), this.assembler.Cache, this.uri); this.posStateList.PossibleState.Add(this.state1); this.posStateList.PossibleState.Add(this.state2); this.posStateList.DefaultState = this.state1; this.stateList.ActualState.Add(new ActualFiniteState(Guid.NewGuid(), this.assembler.Cache, this.uri) { PossibleState = new List <PossibleFiniteState> { this.state1 }, Kind = ActualFiniteStateKind.MANDATORY }); this.stateList.ActualState.Add(new ActualFiniteState(Guid.NewGuid(), this.assembler.Cache, this.uri) { PossibleState = new List <PossibleFiniteState> { this.state2 }, Kind = ActualFiniteStateKind.FORBIDDEN }); this.activeDomain = new DomainOfExpertise(Guid.NewGuid(), this.assembler.Cache, this.uri); this.someotherDomain = new DomainOfExpertise(Guid.NewGuid(), this.assembler.Cache, this.uri); this.qqParamType = new SimpleQuantityKind(Guid.NewGuid(), this.assembler.Cache, this.uri) { Name = "PTName", ShortName = "PTShortName" }; // Array parameter type with components this.apType = new ArrayParameterType(Guid.NewGuid(), this.assembler.Cache, this.uri) { Name = "APTName", ShortName = "APTShortName" }; this.apType.Component.Add(new ParameterTypeComponent(Guid.NewGuid(), this.assembler.Cache, this.uri) { Iid = Guid.NewGuid(), ParameterType = this.qqParamType }); this.apType.Component.Add(new ParameterTypeComponent(Guid.NewGuid(), this.assembler.Cache, this.uri) { Iid = Guid.NewGuid(), ParameterType = this.qqParamType }); // compound parameter type with components this.cptType = new CompoundParameterType(Guid.NewGuid(), this.assembler.Cache, this.uri) { Name = "APTName", ShortName = "APTShortName" }; this.cptType.Component.Add(new ParameterTypeComponent(Guid.NewGuid(), this.assembler.Cache, this.uri) { Iid = Guid.NewGuid(), ParameterType = this.qqParamType }); this.cptType.Component.Add(new ParameterTypeComponent(Guid.NewGuid(), this.assembler.Cache, this.uri) { Iid = Guid.NewGuid(), ParameterType = this.qqParamType }); this.elementDefinition = new ElementDefinition(Guid.NewGuid(), this.assembler.Cache, this.uri) { Owner = this.activeDomain }; var engModel = new EngineeringModel(Guid.NewGuid(), null, null); var modelSetup = new EngineeringModelSetup(Guid.NewGuid(), null, null); var person = new Person(Guid.NewGuid(), null, null) { GivenName = "test", Surname = "test" }; var participant = new Participant(Guid.NewGuid(), null, null) { Person = person }; modelSetup.Participant.Add(participant); engModel.EngineeringModelSetup = modelSetup; this.session.Setup(x => x.ActivePerson).Returns(person); this.session.Setup(x => x.Assembler).Returns(this.assembler); this.session.Setup(x => x.OpenIterations).Returns(new Dictionary <Iteration, Tuple <DomainOfExpertise, Participant> >()); this.iteration = new Iteration(Guid.NewGuid(), this.assembler.Cache, this.uri); this.iteration.Element.Add(this.elementDefinition); this.iteration.Option.Add(this.option1); this.iteration.Option.Add(this.option2); engModel.Iteration.Add(this.iteration); this.elementDefinitionForUsage1 = new ElementDefinition(Guid.NewGuid(), this.assembler.Cache, this.uri) { Owner = this.someotherDomain }; this.elementDefinitionForUsage2 = new ElementDefinition(Guid.NewGuid(), this.assembler.Cache, this.uri) { Owner = this.someotherDomain }; this.elementUsage1 = new ElementUsage(Guid.NewGuid(), this.assembler.Cache, this.uri) { Owner = this.someotherDomain }; this.elementUsage2 = new ElementUsage(Guid.NewGuid(), this.assembler.Cache, this.uri) { Owner = this.someotherDomain }; this.elementUsage1.ElementDefinition = this.elementDefinitionForUsage1; this.elementUsage2.ElementDefinition = this.elementDefinitionForUsage2; this.parameterGroup1 = new ParameterGroup(Guid.NewGuid(), this.assembler.Cache, this.uri); this.parameterGroup2 = new ParameterGroup(Guid.NewGuid(), this.assembler.Cache, this.uri); this.parameterGroup3 = new ParameterGroup(Guid.NewGuid(), this.assembler.Cache, this.uri); this.parameterGroup1ForUsage1 = new ParameterGroup(Guid.NewGuid(), this.assembler.Cache, this.uri); this.parameterGroup2ForUsage2 = new ParameterGroup(Guid.NewGuid(), this.assembler.Cache, this.uri); this.parameterGroup3ForUsage1 = new ParameterGroup(Guid.NewGuid(), this.assembler.Cache, this.uri); this.parameter1 = new Parameter(Guid.NewGuid(), this.assembler.Cache, this.uri) { ParameterType = this.qqParamType, Owner = this.activeDomain }; this.parameter2 = new Parameter(Guid.NewGuid(), this.assembler.Cache, this.uri) { ParameterType = this.qqParamType, Owner = this.activeDomain }; this.parameter3 = new Parameter(Guid.NewGuid(), this.assembler.Cache, this.uri) { ParameterType = this.qqParamType, Owner = this.someotherDomain }; this.parameter4 = new Parameter(Guid.NewGuid(), this.assembler.Cache, this.uri) { ParameterType = this.qqParamType, Owner = this.someotherDomain }; this.parameterForStates = new Parameter(Guid.NewGuid(), this.assembler.Cache, this.uri) { ParameterType = this.qqParamType, Owner = this.someotherDomain, StateDependence = this.stateList }; this.parameter5ForSubscription = new Parameter(Guid.NewGuid(), this.assembler.Cache, this.uri) { ParameterType = this.qqParamType, Owner = this.someotherDomain }; this.parameter6ForOverride = new Parameter(Guid.NewGuid(), this.assembler.Cache, this.uri) { ParameterType = this.qqParamType, Owner = this.activeDomain }; this.parameter6Override = new ParameterOverride(Guid.NewGuid(), this.assembler.Cache, this.uri) { Parameter = this.parameter6ForOverride, Owner = this.activeDomain }; this.parameterArray = new Parameter(Guid.NewGuid(), this.assembler.Cache, this.uri) { ParameterType = this.apType, Owner = this.someotherDomain }; this.parameterCompound = new Parameter(Guid.NewGuid(), this.assembler.Cache, this.uri) { ParameterType = this.cptType, Owner = this.someotherDomain }; this.parameterCompoundForSubscription = new Parameter(Guid.NewGuid(), this.assembler.Cache, this.uri) { ParameterType = this.cptType, Owner = this.someotherDomain }; this.parameterSubscriptionCompound = new ParameterSubscription(Guid.NewGuid(), this.assembler.Cache, this.uri) { Owner = this.activeDomain }; this.parameterCompoundForSubscription.ParameterSubscription.Add(this.parameterSubscriptionCompound); this.parameterForOptions = new Parameter(Guid.NewGuid(), this.assembler.Cache, this.uri) { ParameterType = this.cptType, Owner = this.someotherDomain, IsOptionDependent = true }; this.elementDefinition.ParameterGroup.Add(this.parameterGroup1); this.elementDefinition.ParameterGroup.Add(this.parameterGroup2); this.elementDefinition.ParameterGroup.Add(this.parameterGroup3); this.elementDefinitionForUsage2.ParameterGroup.Add(this.parameterGroup2ForUsage2); this.iteration.Element.Add(elementDefinitionForUsage1); this.iteration.Element.Add(elementDefinitionForUsage2); this.parameterGroup3.ContainingGroup = this.parameterGroup1; this.parameterGroup3ForUsage1.ContainingGroup = this.parameterGroup1ForUsage1; this.parameter4.Group = this.parameterGroup3; }
public void VerifyThatActualFiniteStateKindIsUpdatedOnNewDefault() { var model = new EngineeringModel(Guid.NewGuid(), this.assembler.Cache, this.uri); var iteration = new Iteration(Guid.NewGuid(), this.assembler.Cache, this.uri); var possibleList1 = new PossibleFiniteStateList(Guid.NewGuid(), this.assembler.Cache, this.uri); var possibleList2 = new PossibleFiniteStateList(Guid.NewGuid(), this.assembler.Cache, this.uri); var possibleList3 = new PossibleFiniteStateList(Guid.NewGuid(), this.assembler.Cache, this.uri); var ps11 = new PossibleFiniteState(Guid.NewGuid(), this.assembler.Cache, this.uri); var ps12 = new PossibleFiniteState(Guid.NewGuid(), this.assembler.Cache, this.uri); var ps21 = new PossibleFiniteState(Guid.NewGuid(), this.assembler.Cache, this.uri); var ps22 = new PossibleFiniteState(Guid.NewGuid(), this.assembler.Cache, this.uri); var ps31 = new PossibleFiniteState(Guid.NewGuid(), this.assembler.Cache, this.uri); var ps32 = new PossibleFiniteState(Guid.NewGuid(), this.assembler.Cache, this.uri); possibleList1.PossibleState.Add(ps11); possibleList1.PossibleState.Add(ps12); possibleList2.PossibleState.Add(ps21); possibleList2.PossibleState.Add(ps22); possibleList3.PossibleState.Add(ps31); possibleList3.PossibleState.Add(ps32); var actualList1 = new ActualFiniteStateList(Guid.NewGuid(), this.assembler.Cache, this.uri); var actualList2 = new ActualFiniteStateList(Guid.NewGuid(), this.assembler.Cache, this.uri); actualList1.PossibleFiniteStateList.Add(possibleList1); actualList1.PossibleFiniteStateList.Add(possibleList2); var as11 = new ActualFiniteState(Guid.NewGuid(), this.assembler.Cache, this.uri); as11.PossibleState.Add(ps11); as11.PossibleState.Add(ps21); var as12 = new ActualFiniteState(Guid.NewGuid(), this.assembler.Cache, this.uri); as12.PossibleState.Add(ps11); as12.PossibleState.Add(ps22); var as13 = new ActualFiniteState(Guid.NewGuid(), this.assembler.Cache, this.uri); as13.PossibleState.Add(ps12); as13.PossibleState.Add(ps21); var as14 = new ActualFiniteState(Guid.NewGuid(), this.assembler.Cache, this.uri); as14.PossibleState.Add(ps12); as14.PossibleState.Add(ps22); actualList1.ActualState.Add(as11); actualList1.ActualState.Add(as12); actualList1.ActualState.Add(as13); actualList1.ActualState.Add(as14); actualList2.PossibleFiniteStateList.Add(possibleList2); actualList2.PossibleFiniteStateList.Add(possibleList3); var as21 = new ActualFiniteState(Guid.NewGuid(), this.assembler.Cache, this.uri); as21.PossibleState.Add(ps21); as21.PossibleState.Add(ps31); var as22 = new ActualFiniteState(Guid.NewGuid(), this.assembler.Cache, this.uri); as22.PossibleState.Add(ps21); as22.PossibleState.Add(ps32); var as23 = new ActualFiniteState(Guid.NewGuid(), this.assembler.Cache, this.uri); as23.PossibleState.Add(ps22); as23.PossibleState.Add(ps31); var as24 = new ActualFiniteState(Guid.NewGuid(), this.assembler.Cache, this.uri); as24.PossibleState.Add(ps22); as24.PossibleState.Add(ps32); actualList2.ActualState.Add(as21); actualList2.ActualState.Add(as22); actualList2.ActualState.Add(as23); actualList2.ActualState.Add(as24); model.Iteration.Add(iteration); iteration.PossibleFiniteStateList.Add(possibleList1); iteration.PossibleFiniteStateList.Add(possibleList2); iteration.PossibleFiniteStateList.Add(possibleList3); iteration.ActualFiniteStateList.Add(actualList1); iteration.ActualFiniteStateList.Add(actualList2); this.assembler.Cache.TryAdd(new CacheKey(model.Iid, null), new Lazy <Thing>(() => model)); this.assembler.Cache.TryAdd(new CacheKey(iteration.Iid, null), new Lazy <Thing>(() => iteration)); this.assembler.Cache.TryAdd(new CacheKey(possibleList1.Iid, iteration.Iid), new Lazy <Thing>(() => possibleList1)); this.assembler.Cache.TryAdd(new CacheKey(possibleList2.Iid, iteration.Iid), new Lazy <Thing>(() => possibleList2)); this.assembler.Cache.TryAdd(new CacheKey(possibleList3.Iid, iteration.Iid), new Lazy <Thing>(() => possibleList3)); this.assembler.Cache.TryAdd(new CacheKey(ps11.Iid, iteration.Iid), new Lazy <Thing>(() => ps11)); this.assembler.Cache.TryAdd(new CacheKey(ps12.Iid, iteration.Iid), new Lazy <Thing>(() => ps12)); this.assembler.Cache.TryAdd(new CacheKey(ps21.Iid, iteration.Iid), new Lazy <Thing>(() => ps21)); this.assembler.Cache.TryAdd(new CacheKey(ps22.Iid, iteration.Iid), new Lazy <Thing>(() => ps22)); this.assembler.Cache.TryAdd(new CacheKey(ps31.Iid, iteration.Iid), new Lazy <Thing>(() => ps31)); this.assembler.Cache.TryAdd(new CacheKey(ps32.Iid, iteration.Iid), new Lazy <Thing>(() => ps32)); this.assembler.Cache.TryAdd(new CacheKey(actualList1.Iid, iteration.Iid), new Lazy <Thing>(() => actualList1)); this.assembler.Cache.TryAdd(new CacheKey(actualList2.Iid, iteration.Iid), new Lazy <Thing>(() => actualList2)); this.assembler.Cache.TryAdd(new CacheKey(as11.Iid, iteration.Iid), new Lazy <Thing>(() => as11)); this.assembler.Cache.TryAdd(new CacheKey(as12.Iid, iteration.Iid), new Lazy <Thing>(() => as12)); this.assembler.Cache.TryAdd(new CacheKey(as13.Iid, iteration.Iid), new Lazy <Thing>(() => as13)); this.assembler.Cache.TryAdd(new CacheKey(as14.Iid, iteration.Iid), new Lazy <Thing>(() => as14)); this.assembler.Cache.TryAdd(new CacheKey(as21.Iid, iteration.Iid), new Lazy <Thing>(() => as21)); this.assembler.Cache.TryAdd(new CacheKey(as22.Iid, iteration.Iid), new Lazy <Thing>(() => as22)); this.assembler.Cache.TryAdd(new CacheKey(as23.Iid, iteration.Iid), new Lazy <Thing>(() => as23)); this.assembler.Cache.TryAdd(new CacheKey(as24.Iid, iteration.Iid), new Lazy <Thing>(() => as24)); possibleList1.DefaultState = ps11; as11.Kind = ActualFiniteStateKind.FORBIDDEN; var transactionContext = TransactionContextResolver.ResolveContext(iteration); var context = transactionContext.ContextRoute(); var operationContainer = new OperationContainer(context, model.RevisionNumber); var original = possibleList2.ToDto(); var modify = (CDP4Common.DTO.PossibleFiniteStateList)possibleList2.ToDto(); modify.DefaultState = ps21.Iid; operationContainer.AddOperation(new Operation(original, modify, OperationKind.Update)); Assert.AreEqual(1, operationContainer.Operations.Count()); var modifier = new OperationModifier(this.session.Object); modifier.ModifyOperationContainer(operationContainer); Assert.AreEqual(2, operationContainer.Operations.Count()); var addedOperation = operationContainer.Operations.Last(); var originalActualState = (CDP4Common.DTO.ActualFiniteState)addedOperation.OriginalThing; var modifiedActualState = (CDP4Common.DTO.ActualFiniteState)addedOperation.ModifiedThing; Assert.AreEqual(as11.Iid, originalActualState.Iid); Assert.AreEqual(ActualFiniteStateKind.MANDATORY, modifiedActualState.Kind); Assert.AreEqual(ActualFiniteStateKind.FORBIDDEN, originalActualState.Kind); }
public void Setup() { this.securityContext = new Mock <ISecurityContext>(); this.actualFiniteStateListService = new Mock <IActualFiniteStateListService>(); this.actualFiniteStateService = new Mock <IActualFiniteStateService>(); this.possibleFiniteStateListslService = new Mock <IPossibleFiniteStateListService>(); this.parameterValueSetService = new Mock <IParameterValueSetService>(); this.parameterOverrideValueSetService = new Mock <IParameterOverrideValueSetService>(); this.parameterService = new Mock <IParameterService>(); this.parameterOverrideService = new Mock <IParameterOverrideService>(); this.parameterSubscriptionService = new Mock <IParameterSubscriptionService>(); this.parameterSubscriptionValueSetService = new Mock <IParameterSubscriptionValueSetService>(); this.iterationService = new Mock <IIterationService>(); this.defaultValueArrayFactory = new Mock <IDefaultValueArrayFactory>(); this.parameterUpdateService = new StateDependentParameterUpdateService(); this.finiteStateLogicService = new FiniteStateLogicService(); this.parameterUpdateService.ParameterValueSetService = this.parameterValueSetService.Object; this.parameterUpdateService.ParameterOverrideValueSetService = this.parameterOverrideValueSetService.Object; this.parameterUpdateService.ParameterService = this.parameterService.Object; this.parameterUpdateService.ParameterOverrideService = this.parameterOverrideService.Object; this.parameterUpdateService.ParameterSubscriptionService = this.parameterSubscriptionService.Object; this.parameterUpdateService.ParameterSubscriptionValueSetService = this.parameterSubscriptionValueSetService.Object; this.iteration = new Iteration(Guid.NewGuid(), 1); this.option1 = new Option(Guid.NewGuid(), 1); this.iteration.Option.Add(new OrderedItem { K = 1, V = this.option1.Iid.ToString() }); this.psl1 = new PossibleFiniteStateList(Guid.NewGuid(), 1); this.psl2 = new PossibleFiniteStateList(Guid.NewGuid(), 1); this.ps11 = new PossibleFiniteState(Guid.NewGuid(), 1); this.ps12 = new PossibleFiniteState(Guid.NewGuid(), 1); this.ps21 = new PossibleFiniteState(Guid.NewGuid(), 1); this.ps22 = new PossibleFiniteState(Guid.NewGuid(), 1); this.asl1 = new ActualFiniteStateList(Guid.NewGuid(), 1); this.asl2 = new ActualFiniteStateList(Guid.NewGuid(), 1); this.iteration.PossibleFiniteStateList.Add(this.psl1.Iid); this.iteration.PossibleFiniteStateList.Add(this.psl2.Iid); this.iteration.ActualFiniteStateList.Add(this.asl1.Iid); this.iteration.ActualFiniteStateList.Add(this.asl2.Iid); this.psl1.PossibleState.Add(new OrderedItem { K = 1, V = this.ps11.Iid.ToString() }); this.psl1.PossibleState.Add(new OrderedItem { K = 2, V = this.ps12.Iid.ToString() }); this.psl2.PossibleState.Add(new OrderedItem { K = 1, V = this.ps21.Iid.ToString() }); this.psl2.PossibleState.Add(new OrderedItem { K = 2, V = this.ps22.Iid.ToString() }); this.asl1.PossibleFiniteStateList.Add(new OrderedItem { K = 1, V = this.psl1.Iid.ToString() }); this.asl1.PossibleFiniteStateList.Add(new OrderedItem { K = 2, V = this.psl2.Iid.ToString() }); // initializes actual states actual states this.as11 = new ActualFiniteState(Guid.NewGuid(), 1); this.as11.PossibleState.Add(this.ps11.Iid); this.as11.PossibleState.Add(this.ps21.Iid); this.as12 = new ActualFiniteState(Guid.NewGuid(), 1); this.as12.PossibleState.Add(this.ps11.Iid); this.as12.PossibleState.Add(this.ps22.Iid); this.asl1.ActualState.Add(this.as11.Iid); this.asl1.ActualState.Add(this.as12.Iid); this.asl2.PossibleFiniteStateList.Add(new OrderedItem { K = 1, V = this.psl2.Iid.ToString() }); this.as21 = new ActualFiniteState(Guid.NewGuid(), 1); this.as21.PossibleState.Add(this.ps21.Iid); this.as22 = new ActualFiniteState(Guid.NewGuid(), 1); this.as22.PossibleState.Add(this.ps22.Iid); this.asl2.ActualState.Add(this.as21.Iid); this.asl2.ActualState.Add(this.as22.Iid); this.possibleFiniteStateListslService.Setup( x => x.GetShallow(this.transaction, this.partition, It.IsAny <IEnumerable <Guid> >(), this.securityContext.Object)) .Returns(new List <Thing> { this.psl1, this.psl2 }); this.actualFiniteStateListService.Setup( x => x.GetShallow(this.transaction, this.partition, null, this.securityContext.Object)) .Returns(new List <Thing> { this.asl1, this.asl2 }); this.actualFiniteStateService.Setup( x => x.GetShallow(this.transaction, this.partition, It.IsAny <IEnumerable <Guid> >(), this.securityContext.Object)) .Returns(new List <Thing> { this.as11, this.as12 }); this.iterationService.Setup(x => x.GetActiveIteration(this.transaction, this.partition, this.securityContext.Object)) .Returns(this.iteration); this.parameter1 = new Parameter(Guid.NewGuid(), 1); this.parameter1.StateDependence = this.asl1.Iid; this.parameter2 = new Parameter(Guid.NewGuid(), 1); this.parameter2.StateDependence = this.asl1.Iid; this.parameter2.IsOptionDependent = true; this.parameterOverride1 = new ParameterOverride(Guid.NewGuid(), 1); this.parameterOverride1.Parameter = this.parameter1.Iid; this.parameterOverride2 = new ParameterOverride(Guid.NewGuid(), 1); this.parameterOverride2.Parameter = this.parameter2.Iid; this.parameterSubscription1 = new ParameterSubscription(Guid.NewGuid(), 1); this.parameterSubscription2 = new ParameterSubscription(Guid.NewGuid(), 1); this.parameter1.ParameterSubscription.Add(this.parameterSubscription1.Iid); this.parameterOverride2.ParameterSubscription.Add(this.parameterSubscription2.Iid); this.pvs11 = new ParameterValueSet(Guid.NewGuid(), 1) { Manual = new ValueArray <string>(this.initValue), Computed = new ValueArray <string>(this.initValue), Reference = new ValueArray <string>(this.initValue), Published = new ValueArray <string>(this.initValue), Formula = new ValueArray <string>(this.initValue), ValueSwitch = CDP4Common.EngineeringModelData.ParameterSwitchKind.REFERENCE, }; this.pvs12 = new ParameterValueSet(Guid.NewGuid(), 1) { Manual = new ValueArray <string>(this.initValue), Computed = new ValueArray <string>(this.initValue), Reference = new ValueArray <string>(this.initValue), Published = new ValueArray <string>(this.initValue), Formula = new ValueArray <string>(this.initValue), ValueSwitch = CDP4Common.EngineeringModelData.ParameterSwitchKind.REFERENCE, }; this.pvs21 = new ParameterValueSet(Guid.NewGuid(), 1) { Manual = new ValueArray <string>(this.initValue), Computed = new ValueArray <string>(this.initValue), Reference = new ValueArray <string>(this.initValue), Published = new ValueArray <string>(this.initValue), Formula = new ValueArray <string>(this.initValue), ValueSwitch = CDP4Common.EngineeringModelData.ParameterSwitchKind.REFERENCE, }; this.pvs22 = new ParameterValueSet(Guid.NewGuid(), 1) { Manual = new ValueArray <string>(this.initValue), Computed = new ValueArray <string>(this.initValue), Reference = new ValueArray <string>(this.initValue), Published = new ValueArray <string>(this.initValue), Formula = new ValueArray <string>(this.initValue), ValueSwitch = CDP4Common.EngineeringModelData.ParameterSwitchKind.REFERENCE, }; this.povs11 = new ParameterOverrideValueSet(Guid.NewGuid(), 1) { Manual = new ValueArray <string>(this.initValue), Computed = new ValueArray <string>(this.initValue), Reference = new ValueArray <string>(this.initValue), Published = new ValueArray <string>(this.initValue), Formula = new ValueArray <string>(this.initValue), ValueSwitch = CDP4Common.EngineeringModelData.ParameterSwitchKind.REFERENCE, ParameterValueSet = this.pvs11.Iid }; this.povs12 = new ParameterOverrideValueSet(Guid.NewGuid(), 1) { Manual = new ValueArray <string>(this.initValue), Computed = new ValueArray <string>(this.initValue), Reference = new ValueArray <string>(this.initValue), Published = new ValueArray <string>(this.initValue), Formula = new ValueArray <string>(this.initValue), ValueSwitch = CDP4Common.EngineeringModelData.ParameterSwitchKind.REFERENCE, ParameterValueSet = this.pvs11.Iid }; this.povs21 = new ParameterOverrideValueSet(Guid.NewGuid(), 1) { Manual = new ValueArray <string>(this.initValue), Computed = new ValueArray <string>(this.initValue), Reference = new ValueArray <string>(this.initValue), Published = new ValueArray <string>(this.initValue), Formula = new ValueArray <string>(this.initValue), ValueSwitch = CDP4Common.EngineeringModelData.ParameterSwitchKind.REFERENCE, ParameterValueSet = this.pvs11.Iid }; this.povs22 = new ParameterOverrideValueSet(Guid.NewGuid(), 1) { Manual = new ValueArray <string>(this.initValue), Computed = new ValueArray <string>(this.initValue), Reference = new ValueArray <string>(this.initValue), Published = new ValueArray <string>(this.initValue), Formula = new ValueArray <string>(this.initValue), ValueSwitch = CDP4Common.EngineeringModelData.ParameterSwitchKind.REFERENCE, ParameterValueSet = this.pvs11.Iid }; this.psvs11 = new ParameterSubscriptionValueSet(Guid.NewGuid(), 1) { Manual = new ValueArray <string>(this.initValue), ValueSwitch = CDP4Common.EngineeringModelData.ParameterSwitchKind.REFERENCE, SubscribedValueSet = this.pvs11.Iid }; this.psvs12 = new ParameterSubscriptionValueSet(Guid.NewGuid(), 1) { Manual = new ValueArray <string>(this.initValue), ValueSwitch = CDP4Common.EngineeringModelData.ParameterSwitchKind.REFERENCE, SubscribedValueSet = this.pvs12.Iid }; this.psvs21 = new ParameterSubscriptionValueSet(Guid.NewGuid(), 1) { Manual = new ValueArray <string>(this.initValue), ValueSwitch = CDP4Common.EngineeringModelData.ParameterSwitchKind.REFERENCE, SubscribedValueSet = this.povs21.Iid }; this.psvs22 = new ParameterSubscriptionValueSet(Guid.NewGuid(), 1) { Manual = new ValueArray <string>(this.initValue), ValueSwitch = CDP4Common.EngineeringModelData.ParameterSwitchKind.REFERENCE, SubscribedValueSet = this.povs22.Iid }; this.parameter1.ValueSet.Add(this.pvs11.Iid); this.parameter1.ValueSet.Add(this.pvs12.Iid); this.parameter2.ValueSet.Add(this.pvs21.Iid); this.parameter2.ValueSet.Add(this.pvs22.Iid); this.parameterOverride1.ValueSet.Add(this.povs11.Iid); this.parameterOverride1.ValueSet.Add(this.povs12.Iid); this.parameterOverride2.ValueSet.Add(this.povs21.Iid); this.parameterOverride2.ValueSet.Add(this.povs22.Iid); this.parameterSubscription1.ValueSet.Add(this.psvs11.Iid); this.parameterSubscription1.ValueSet.Add(this.psvs12.Iid); this.parameterSubscription2.ValueSet.Add(this.psvs21.Iid); this.parameterSubscription2.ValueSet.Add(this.psvs22.Iid); this.parameterService.Setup(x => x.GetShallow(this.transaction, this.partition, null, this.securityContext.Object)) .Returns(new List <Thing> { this.parameter1, this.parameter2 }); this.parameterOverrideService.Setup(x => x.GetShallow(this.transaction, this.partition, null, this.securityContext.Object)) .Returns(new List <Thing> { this.parameterOverride1, this.parameterOverride2 }); this.parameterSubscriptionService.Setup(x => x.GetShallow(this.transaction, this.partition, null, this.securityContext.Object)) .Returns(new List <Thing> { this.parameterSubscription1, this.parameterSubscription2 }); this.parameterValueSetService.Setup( x => x.GetShallow(this.transaction, this.partition, this.parameter1.ValueSet, this.securityContext.Object)) .Returns(new List <Thing> { this.pvs11, this.pvs12 }); this.parameterValueSetService.Setup( x => x.GetShallow(this.transaction, this.partition, this.parameter2.ValueSet, this.securityContext.Object)) .Returns(new List <Thing> { this.pvs21, this.pvs22 }); this.parameterOverrideValueSetService.Setup( x => x.GetShallow(this.transaction, this.partition, this.parameterOverride1.ValueSet, this.securityContext.Object)) .Returns(new List <Thing> { this.povs11, this.povs12 }); this.parameterOverrideValueSetService.Setup( x => x.GetShallow(this.transaction, this.partition, this.parameterOverride2.ValueSet, this.securityContext.Object)) .Returns(new List <Thing> { this.povs21, this.povs22 }); this.parameterSubscriptionValueSetService.Setup( x => x.GetShallow(this.transaction, this.partition, this.parameterSubscription1.ValueSet, this.securityContext.Object)) .Returns(new List <Thing> { this.psvs11, this.psvs12 }); this.parameterSubscriptionValueSetService.Setup( x => x.GetShallow(this.transaction, this.partition, this.parameterSubscription2.ValueSet, this.securityContext.Object)) .Returns(new List <Thing> { this.psvs21, this.psvs22 }); this.defaultValueArrayFactory.Setup(x => x.CreateDefaultValueArray(It.IsAny <Guid>())).Returns(new ValueArray <string>(new[] { "-" })); this.finiteStateLogicService.ActualFiniteStateListService = this.actualFiniteStateListService.Object; this.finiteStateLogicService.ActualFiniteStateService = this.actualFiniteStateService.Object; this.finiteStateLogicService.IterationService = this.iterationService.Object; this.finiteStateLogicService.PossibleFiniteStateListService = this.possibleFiniteStateListslService.Object; this.finiteStateLogicService.StateDependentParameterUpdateService = this.parameterUpdateService; this.sideEffect.FiniteStateLogicService = this.finiteStateLogicService; this.parameterUpdateService.DefaultValueSetFactory = this.defaultValueArrayFactory.Object; this.parameterValueSetService.Setup(x => x.DeleteConcept(this.transaction, this.partition, It.IsAny <ParameterValueSet>(), It.IsAny <Parameter>())).Returns(true); this.parameterOverrideValueSetService.Setup(x => x.DeleteConcept(this.transaction, this.partition, It.IsAny <ParameterOverrideValueSet>(), It.IsAny <ParameterOverride>())).Returns(true); this.parameterSubscriptionValueSetService.Setup(x => x.DeleteConcept(this.transaction, this.partition, It.IsAny <ParameterSubscriptionValueSet>(), It.IsAny <ParameterSubscription>())).Returns(true); }