Exemple #1
0
        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();
        }
Exemple #2
0
        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"
            };
            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.elementdef = 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.elementdef);

            this.parameterType = new EnumerationParameterType(Guid.NewGuid(), this.cache, this.uri)
            {
                Name = "pt1"
            };
            this.parameter = new Parameter(Guid.NewGuid(), this.cache, this.uri)
            {
                ParameterType = this.parameterType, Owner = this.domain
            };
            this.converter = new ProductTreeIconUriConverter();
            this.elementdef.Parameter.Add(this.parameter);
            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.parameter.Iid, null), new Lazy <Thing>(() => this.parameter));

            this.serviceLocator = new Mock <IServiceLocator>();
            ServiceLocator.SetLocatorProvider(() => this.serviceLocator.Object);

            this.nestedElementTreeService = new Mock <INestedElementTreeService>();
            this.serviceLocator.Setup(x => x.GetInstance <INestedElementTreeService>()).Returns(this.nestedElementTreeService.Object);
        }
Exemple #3
0
        /// <summary>
        /// Select node and adds icon to it
        /// </summary>
        /// <param name="rowData"><see cref="TreeListRowData"/></param>
        /// <returns>ImageSource</returns>
        public override ImageSource Select(TreeListRowData rowData)
        {
            var thingStatus = ((IHaveThingStatus)rowData.Row).ThingStatus;

            if (rowData.Row is ParameterOrOverrideBaseRowViewModel parameterOrOverrideBaseRow)
            {
                var productTreeIconConverter = new ProductTreeIconUriConverter();
                var productTreeIcon          = productTreeIconConverter.Convert(new object[] { thingStatus, parameterOrOverrideBaseRow.Usage }, null, null, CultureInfo.InvariantCulture);
                return(productTreeIcon as ImageSource);
            }

            var converter = new ThingToIconUriConverter();
            var icon      = converter.Convert(new object[] { thingStatus }, null, null, CultureInfo.InvariantCulture);

            return(icon as ImageSource);
        }
Exemple #4
0
        public void Setup()
        {
            var ensurePackSchemeIsKnown = 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)
            {
                ShortName = "Def1",
                Owner     = this.domain
            };

            this.elementUsage1 = new ElementUsage(Guid.NewGuid(), this.cache, this.uri)
            {
                ShortName         = "Usage1",
                Container         = this.elementdef1,
                ElementDefinition = this.elementdef1,
                Owner             = this.domain
            };

            this.category1 = new Category(Guid.NewGuid(), this.cache, this.uri);
            this.category2 = new Category(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", Category = new List <Category>()
                {
                    this.category1
                }
            };
            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.elementdef1.Category.Add(this.category1);
            this.elementUsage1.Category.Add(this.category2);

            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();

            this.relationalExpression = new RelationalExpression();
            this.serviceLocator       = new Mock <IServiceLocator>();
            this.thingCreator         = new Mock <IThingCreator>();

            ServiceLocator.SetLocatorProvider(() => this.serviceLocator.Object);

            this.nestedElementTreeService = new Mock <INestedElementTreeService>();
            this.nestedElementTreeService.Setup(x => x.GetNestedParameterPath(It.IsAny <ParameterBase>(), It.IsAny <Option>())).Returns(this.nestedParameterPath);

            this.serviceLocator.Setup(x => x.GetInstance <INestedElementTreeService>()).Returns(this.nestedElementTreeService.Object);

            this.serviceLocator.Setup(x => x.GetInstance <IThingCreator>())
            .Returns(this.thingCreator.Object);

            this.thingCreator.Setup(x => x.IsCreateBinaryRelationshipForRequirementVerificationAllowed(It.IsAny <ParameterOrOverrideBase>(), It.IsAny <RelationalExpression>()))
            .Returns(true);
        }