Esempio n. 1
0
        /// <summary>
        /// Add the row of the associated <see cref="ElementDefinition"/>
        /// </summary>
        /// <param name="elementDef">The <see cref="ElementDefinition"/> to add</param>
        private void AddElementDefinitionRow(ElementDefinition elementDef)
        {
            this.Session.OpenIterations.TryGetValue(this.Thing, out var tuple);

            if (tuple != null)
            {
                var row = new ElementDefinitionRowViewModel(elementDef, tuple.Item1, this.Session, this);
                this.ElementDefinitionRowViewModels.SortedInsert(row, rowComparer);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Add the row of the associated <see cref="ElementDefinition"/>
        /// </summary>
        /// <param name="elementDef">The <see cref="ElementDefinition"/> to add</param>
        private void AddElementDefinitionRow(ElementDefinition elementDef)
        {
            Tuple <DomainOfExpertise, Participant> tuple;

            this.Session.OpenIterations.TryGetValue(this.Thing, out tuple);

            var row = new ElementDefinitionRowViewModel(elementDef, tuple.Item1, this.Session, this);

            this.ElementDefinitionRowViewModels.SortedInsert(row, rowComparer);
        }
        public void VerifyCreateParameterOverride()
        {
            var browser      = new ElementDefinitionsBrowserViewModel(this.iteration, this.session.Object, null, this.panelNavigationService.Object, null, null, null, null);
            var elementUsage = new ElementUsage(Guid.NewGuid(), this.assembler.Cache, this.uri)
            {
                Owner = this.elementDef.Owner, ElementDefinition = this.elementDef, Container = this.elementDef
            };
            var usageRow  = new ElementUsageRowViewModel(elementUsage, this.elementDef.Owner, this.session.Object, null, this.obfuscationService.Object);
            var qk        = new SimpleQuantityKind();
            var parameter = new Parameter(Guid.NewGuid(), this.assembler.Cache, this.uri)
            {
                Container     = this.elementDef,
                ParameterType = qk,
                Owner         = this.elementDef.Owner
            };

            var parameterRow = new ParameterRowViewModel(parameter, this.session.Object, usageRow, false);

            Assert.IsFalse(browser.CreateOverrideCommand.CanExecute(null));
            browser.SelectedThing = parameterRow;
            Assert.IsTrue(browser.CreateOverrideCommand.CanExecute(null));
            browser.CreateOverrideCommand.Execute(parameter);

            this.session.Verify(x => x.Write(It.IsAny <OperationContainer>()));

            browser.SelectedThing = null;
            browser.ComputePermission();
            browser.CreateOverrideCommand.Execute(null);
            this.session.Verify(x => x.Write(It.IsAny <OperationContainer>()), Times.Once);

            var paramtType = new CompoundParameterType(Guid.NewGuid(), this.assembler.Cache, this.uri);

            paramtType.Component.Add(new ParameterTypeComponent(Guid.NewGuid(), this.assembler.Cache, this.uri)
            {
                ParameterType = new BooleanParameterType(Guid.NewGuid(), this.assembler.Cache, this.uri), Scale = null
            });
            parameter.ParameterType = paramtType;

            var elementDefRow         = new ElementDefinitionRowViewModel(this.elementDef, this.elementDef.Owner, this.session.Object, null, this.obfuscationService.Object);
            var parameterValueBaseRow = new ParameterComponentValueRowViewModel(parameter, 0, this.session.Object, null, null, elementDefRow, false);

            browser.SelectedThing = parameterValueBaseRow;
            browser.ComputePermission();
            browser.CreateOverrideCommand.Execute(null);

            var parameterOverride = new ParameterOverride(Guid.NewGuid(), this.assembler.Cache, this.uri)
            {
                Parameter = parameter, Owner = this.elementDef.Owner
            };

            parameterValueBaseRow = new ParameterComponentValueRowViewModel(parameterOverride, 0, this.session.Object, null, null, usageRow, false);
            browser.SelectedThing = parameterValueBaseRow;
            browser.CreateOverrideCommand.Execute(null);
        }