Exemple #1
0
        public void SetUp()
        {
            this.uri   = new Uri("http://www.rheagroup.com");
            this.cache = new ConcurrentDictionary <CDP4Common.Types.CacheKey, Lazy <Thing> >();

            this.systemEngineering = new DomainOfExpertise(Guid.NewGuid(), this.cache, this.uri)
            {
                Name = "System Engineering", ShortName = "SYS"
            };
            this.powerEngineering = new DomainOfExpertise(Guid.NewGuid(), this.cache, this.uri)
            {
                Name = "Power Engineering", ShortName = "PWR"
            };

            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);
            this.satellite = new ElementDefinition(Guid.NewGuid(), this.cache, this.uri)
            {
                Owner = this.systemEngineering
            };
            this.iteration.Element.Add(this.satellite);
            this.sateliteMass = new Parameter(Guid.NewGuid(), this.cache, this.uri)
            {
                Owner = this.systemEngineering
            };
            this.satellite.Parameter.Add(this.sateliteMass);

            this.battery = new ElementDefinition(Guid.NewGuid(), this.cache, this.uri)
            {
                Owner = this.powerEngineering
            };
            this.iteration.Element.Add(this.battery);
            this.batteryMass = new Parameter(Guid.NewGuid(), this.cache, this.uri)
            {
                Owner = this.powerEngineering
            };
            this.battery.Parameter.Add(this.batteryMass);

            this.batteryUsage = new ElementUsage(Guid.NewGuid(), this.cache, this.uri)
            {
                Owner = this.powerEngineering, ElementDefinition = this.battery
            };
            this.satellite.ContainedElement.Add(this.batteryUsage);

            this.session = new Mock <ISession>();

            this.changeOwnershipBatchService = new ChangeOwnershipBatchService();
        }
Exemple #2
0
        public void VerifyDropElementDef()
        {
            var domain = new DomainOfExpertise(Guid.NewGuid(), this.assembler.Cache, this.uri);

            this.sitedir.Domain.Add(domain);
            this.engineeringModelSetup.ActiveDomain.Add(domain);

            var model2      = new EngineeringModel(Guid.NewGuid(), this.assembler.Cache, this.uri);
            var modelsetup2 = new EngineeringModelSetup(Guid.NewGuid(), this.assembler.Cache, this.uri);

            modelsetup2.EngineeringModelIid = model2.Iid;
            model2.EngineeringModelSetup    = modelsetup2;
            modelsetup2.ActiveDomain.Add(domain);

            this.sitedir.Model.Add(modelsetup2);

            var model2Iteration = new Iteration(Guid.NewGuid(), this.assembler.Cache, this.uri);
            var def             = new ElementDefinition(Guid.NewGuid(), this.assembler.Cache, this.uri);

            def.Owner = domain;

            model2.Iteration.Add(model2Iteration);
            model2Iteration.Element.Add(def);

            this.assembler.Cache.TryAdd(new CacheKey(model2.Iid, null), new Lazy <Thing>(() => model2));
            this.assembler.Cache.TryAdd(new CacheKey(model2Iteration.Iid, null), new Lazy <Thing>(() => model2Iteration));
            this.assembler.Cache.TryAdd(new CacheKey(def.Iid, model2Iteration.Iid), new Lazy <Thing>(() => def));

            var vm = new ElementDefinitionsBrowserViewModel(this.iteration, this.session.Object, null, null, null, null);

            var dropinfo = new Mock <IDropInfo>();

            this.session.Setup(x => x.OpenIterations)
            .Returns(new Dictionary <Iteration, Tuple <DomainOfExpertise, Participant> >
            {
                { this.iteration, new Tuple <DomainOfExpertise, Participant>(domain, null) },
                { model2Iteration, new Tuple <DomainOfExpertise, Participant>(domain, null) }
            });

            this.permissionService.Setup(x => x.CanWrite(It.IsAny <ClassKind>(), It.IsAny <Thing>())).Returns(true);

            dropinfo.Setup(x => x.Payload).Returns(def);
            dropinfo.Setup(x => x.KeyStates).Returns(DragDropKeyStates.LeftMouseButton);

            dropinfo.SetupProperty(x => x.Effects);
            dropinfo.Object.Effects = DragDropEffects.All;

            vm.Drop(dropinfo.Object);
            Assert.That(vm.Feedback, Is.Null.Or.Empty);
        }
Exemple #3
0
        public void Setup()
        {
            this.rev = typeof(Thing).GetProperty("RevisionNumber");

            this.session                      = new Mock <ISession>();
            this.permissionService            = new Mock <IPermissionService>();
            this.thingDialogNavigationService = new Mock <IThingDialogNavigationService>();
            this.panelNavigationService       = new Mock <IPanelNavigationService>();
            this.cache = new ConcurrentDictionary <CacheKey, Lazy <Thing> >();
            this.session.Setup(x => x.PermissionService).Returns(this.permissionService.Object);

            this.sitedir    = new SiteDirectory(Guid.NewGuid(), this.cache, this.uri);
            this.modelsetup = new EngineeringModelSetup(Guid.NewGuid(), this.cache, this.uri)
            {
                Name = "model"
            };
            this.iterationsetup = new IterationSetup(Guid.NewGuid(), this.cache, this.uri);
            this.person         = new Person(Guid.NewGuid(), this.cache, this.uri);
            this.domain         = new DomainOfExpertise(Guid.NewGuid(), this.cache, this.uri)
            {
                Name = "domain"
            };
            this.participant = new Participant(Guid.NewGuid(), this.cache, this.uri)
            {
                Person = this.person, SelectedDomain = this.domain
            };

            this.sitedir.Model.Add(this.modelsetup);
            this.sitedir.Person.Add(this.person);
            this.sitedir.Domain.Add(this.domain);
            this.modelsetup.IterationSetup.Add(this.iterationsetup);
            this.modelsetup.Participant.Add(this.participant);

            this.model = new EngineeringModel(Guid.NewGuid(), this.cache, this.uri)
            {
                EngineeringModelSetup = this.modelsetup
            };
            this.iteration = new Iteration(Guid.NewGuid(), this.cache, this.uri)
            {
                IterationSetup = this.iterationsetup
            };
            this.model.Iteration.Add(this.iteration);

            this.session.Setup(x => x.RetrieveSiteDirectory()).Returns(this.sitedir);
            this.session.Setup(x => x.ActivePerson).Returns(this.person);

            this.cache.TryAdd(new CacheKey(this.iteration.Iid, null), new Lazy <Thing>(() => this.iteration));
            this.permissionService.Setup(x => x.CanWrite(It.IsAny <ClassKind>(), It.IsAny <Thing>())).Returns(true);
        }
        public void VerifyThatTopContainerRouteIsCorrect()
        {
            // iteration thing
            ElementDefinition elementDefinition;

            var elementDefinitionId = Guid.NewGuid();
            var iterationId         = Guid.NewGuid();
            var engineeringModelId  = Guid.NewGuid();

            elementDefinition = new ElementDefinition(elementDefinitionId, 1);
            elementDefinition.AddContainer(ClassKind.Iteration, iterationId);
            elementDefinition.AddContainer(ClassKind.EngineeringModel, engineeringModelId);

            Assert.AreEqual(string.Format("/EngineeringModel/{0}/iteration/{1}", engineeringModelId, iterationId), elementDefinition.GetTopContainerRoute());

            // engineering model thing
            Book    book;
            Section section;

            book = new Book(Guid.NewGuid(), 1);
            book.AddContainer(ClassKind.EngineeringModel, engineeringModelId);
            section = new Section(Guid.NewGuid(), 1);
            section.AddContainer(ClassKind.Book, book.Iid);
            section.AddContainer(ClassKind.EngineeringModel, engineeringModelId);

            Assert.AreEqual($"/EngineeringModel/{engineeringModelId}", book.GetTopContainerRoute());
            Assert.AreEqual($"/EngineeringModel/{engineeringModelId}", section.GetTopContainerRoute());

            EngineeringModel enModel;

            enModel = new EngineeringModel(Guid.NewGuid(), 1);

            Assert.AreEqual($"/EngineeringModel/{enModel.Iid}", enModel.GetTopContainerRoute());

            // site directory thing
            BooleanParameterType booleanParameterType;

            var booleanParameterTypeId     = Guid.NewGuid();
            var siteReferenceDataLibraryId = Guid.NewGuid();
            var siteDirectoryId            = Guid.NewGuid();
            var siteDirectory = new SiteDirectory(siteDirectoryId, 1);

            booleanParameterType = new BooleanParameterType(booleanParameterTypeId, 1);
            booleanParameterType.AddContainer(ClassKind.SiteReferenceDataLibrary, siteReferenceDataLibraryId);
            booleanParameterType.AddContainer(ClassKind.SiteDirectory, siteDirectoryId);

            Assert.That(booleanParameterType.GetTopContainerRoute(), Is.EqualTo($"/SiteDirectory/{siteDirectoryId}"));
            Assert.That(siteDirectory.GetTopContainerRoute(), Is.EqualTo($"/SiteDirectory/{siteDirectoryId}"));
        }
Exemple #5
0
        public void VerifyThatIterationDataToDtoWork()
        {
            var model      = new EngineeringModel(Guid.NewGuid(), null, null);
            var iteratio   = new Iteration(Guid.NewGuid(), null, null);
            var elementdef = new ElementDefinition(Guid.NewGuid(), null, null);

            model.Iteration.Add(iteratio);
            iteratio.Element.Add(elementdef);

            var iterationDto = iteratio.ToDto();
            var defDto       = elementdef.ToDto();

            Assert.IsNull(iterationDto.IterationContainerId);
            Assert.AreEqual(iteratio.Iid, defDto.IterationContainerId);
        }
        public void SetUp()
        {
            this.externalIdentifierMapRuleChecker = new ExternalIdentifierMapRuleChecker();

            this.modelReferenceDataLibrary = new ModelReferenceDataLibrary();
            this.engineeringModelSetup     = new EngineeringModelSetup();
            this.engineeringModel          = new EngineeringModel();
            this.iteration             = new Iteration();
            this.externalIdentifierMap = new ExternalIdentifierMap();

            this.engineeringModelSetup.RequiredRdl.Add(this.modelReferenceDataLibrary);
            this.engineeringModel.EngineeringModelSetup = this.engineeringModelSetup;
            this.engineeringModel.Iteration.Add(this.iteration);
            this.iteration.ExternalIdentifierMap.Add(this.externalIdentifierMap);
        }
Exemple #7
0
        public void Setup()
        {
            this.sitedir = new SiteDirectory();
            this.srdl    = new SiteReferenceDataLibrary();
            sitedir.SiteReferenceDataLibrary.Add(srdl);

            this.cat1  = new Category();
            this.cat2  = new Category();
            this.rule1 = new BinaryRelationshipRule {
                RelationshipCategory = cat1
            };
            this.rule2 = new BinaryRelationshipRule {
                RelationshipCategory = cat2
            };

            srdl.DefinedCategory.Add(cat1);
            srdl.DefinedCategory.Add(cat2);
            srdl.Rule.Add(rule1);
            srdl.Rule.Add(rule2);

            this.modelSetup = new EngineeringModelSetup();
            this.mrdl       = new ModelReferenceDataLibrary {
                RequiredRdl = srdl
            };
            modelSetup.RequiredRdl.Add(mrdl);

            this.cat3  = new Category();
            this.rule3 = new BinaryRelationshipRule {
                RelationshipCategory = cat3
            };
            this.rule11 = new BinaryRelationshipRule {
                RelationshipCategory = cat1
            };
            mrdl.DefinedCategory.Add(cat3);
            mrdl.Rule.Add(rule3);
            mrdl.Rule.Add(rule11);

            this.iterationSetup = new IterationSetup();
            modelSetup.IterationSetup.Add(iterationSetup);

            this.model = new EngineeringModel {
                EngineeringModelSetup = modelSetup
            };
            this.iteration = new Iteration {
                IterationSetup = iterationSetup
            };
            model.Iteration.Add(iteration);
        }
Exemple #8
0
        public void SetUp()
        {
            this.parameterType = new TextParameterType(Guid.NewGuid(), null, null)
            {
                ShortName = "TXT"
            };

            var engineeringModel = new EngineeringModel(Guid.NewGuid(), null, null);
            var iteration        = new Iteration(Guid.NewGuid(), null, null);

            engineeringModel.Iteration.Add(iteration);

            this.elementDefinition           = new ElementDefinition(Guid.NewGuid(), null, null);
            this.elementDefinition.ShortName = "BAT";
            iteration.Element.Add(this.elementDefinition);

            var parameter = new Parameter(Guid.NewGuid(), null, null)
            {
                ParameterType = this.parameterType
            };

            this.elementDefinition.Parameter.Add(parameter);
            this.parameterValueSet = new ParameterValueSet(Guid.NewGuid(), null, null);
            var manual = new ValueArray <string>(new List <string>()
            {
                "1"
            });
            var computed = new ValueArray <string>(new List <string>()
            {
                "2"
            });
            var reference = new ValueArray <string>(new List <string>()
            {
                "3"
            });
            var formula = new ValueArray <string>(new List <string>()
            {
                "-"
            });

            this.parameterValueSet.Manual      = manual;
            this.parameterValueSet.Computed    = computed;
            this.parameterValueSet.Reference   = reference;
            this.parameterValueSet.Formula     = formula;
            this.parameterValueSet.ValueSwitch = ParameterSwitchKind.MANUAL;

            parameter.ValueSet.Add(this.parameterValueSet);
        }
        private void SetupData()
        {
            this.Transactions.Clear();
            this.SessionService = new Mock <ISessionService>();
            this.FilterService  = new Mock <IFilterService>();
            this.Session        = new Mock <ISession>();
            this.uri            = new Uri(BaseUri);
            this.Assembler      = new Assembler(this.uri);
            this.siteDirectory  = new SiteDirectory(Guid.NewGuid(), this.Assembler.Cache, this.uri);

            this.SetupDomainPersonAndParticipant();

            this.model     = new EngineeringModel(Guid.NewGuid(), this.Assembler.Cache, this.uri);
            this.Iteration = new Iteration(Guid.NewGuid(), this.Assembler.Cache, this.uri);

            this.siteReferenceDataLibrary = new SiteReferenceDataLibrary(Guid.NewGuid(), this.Assembler.Cache, this.uri);
            this.siteDirectory.SiteReferenceDataLibrary.Add(this.siteReferenceDataLibrary);

            this.modelReferenceDataLibrary = new ModelReferenceDataLibrary(Guid.NewGuid(), this.Assembler.Cache, this.uri)
            {
                RequiredRdl = this.siteReferenceDataLibrary
            };

            this.SetupScales();
            this.SetupFiniteStates();
            this.SetupElementDefinitionsAndUsages();

            this.model.Iteration.Add(this.Iteration);

            var iterationSetup = new IterationSetup(Guid.NewGuid(), this.Assembler.Cache, this.uri);

            this.Iteration.IterationSetup = iterationSetup;

            this.engineeringModelSetup = new EngineeringModelSetup(Guid.NewGuid(), this.Assembler.Cache, this.uri)
            {
                Name = "TEST"
            };
            this.engineeringModelSetup.IterationSetup.Add(iterationSetup);

            this.engineeringModelSetup.RequiredRdl.Add(this.modelReferenceDataLibrary);

            this.model.EngineeringModelSetup = this.engineeringModelSetup;
            this.model.EngineeringModelSetup.Participant.Add(this.participant);

            this.Assembler.Cache.TryAdd(new CacheKey(this.Iteration.Iid, null), new Lazy <Thing>(() => this.Iteration));

            this.AddThingsInCache();
        }
        public void SetUp()
        {
            RxApp.MainThreadScheduler = Scheduler.CurrentThread;

            this.assembler = new Assembler(this.uri);
            this.cache     = this.assembler.Cache;

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

            this.thingDialogNavigationService = new Mock <IThingDialogNavigationService>();
            this.session           = new Mock <ISession>();
            this.permissionService = new Mock <IPermissionService>();

            this.SetupIRuleVerificationService();

            this.siteDirectory           = new SiteDirectory(Guid.NewGuid(), this.cache, this.uri);
            this.systemDomainOfExpertise = new DomainOfExpertise(Guid.NewGuid(), this.cache, this.uri)
            {
                Name = "System", ShortName = "SYS"
            };
            this.siteDirectory.Domain.Add(this.systemDomainOfExpertise);

            var engineeringModelSetup = new EngineeringModelSetup(Guid.NewGuid(), this.cache, this.uri);

            this.engineeringModel = new EngineeringModel(Guid.NewGuid(), this.cache, this.uri);
            this.engineeringModel.EngineeringModelSetup = engineeringModelSetup;
            this.iteration = new Iteration(Guid.NewGuid(), this.cache, this.uri);
            this.engineeringModel.Iteration.Add(this.iteration);

            this.ruleVerificationList = new RuleVerificationList(Guid.NewGuid(), this.cache, this.uri)
            {
                Owner = this.systemDomainOfExpertise
            };

            this.builtInRuleVerification = new BuiltInRuleVerification(Guid.NewGuid(), this.cache, this.uri);
            this.ruleVerificationList.RuleVerification.Add(this.builtInRuleVerification);

            var transactionContext = TransactionContextResolver.ResolveContext(this.iteration);

            this.thingTransaction = new ThingTransaction(transactionContext, null);

            var dal = new Mock <IDal>();

            this.session.Setup(x => x.DalVersion).Returns(new Version(1, 1, 0));
            this.session.Setup(x => x.Dal).Returns(dal.Object);
            dal.Setup(x => x.MetaDataProvider).Returns(new MetaDataProvider());
        }
        public void Verify_that_when_a_ICategorizableThing_is_a_member_of_a_Category_that_is_not_in_the_chain_of_rdl_a_result_is_returned()
        {
            var siteReferenceDataLibrary_1 = new SiteReferenceDataLibrary();
            var category = new Category()
            {
                Iid = Guid.Parse("0b8f399c-a1b2-4993-abc3-31f2ad880936"), ShortName = "CAT"
            };

            siteReferenceDataLibrary_1.DefinedCategory.Add(category);

            var siteReferenceDataLibrary_2 = new SiteReferenceDataLibrary();
            var fileType = new FileType {
                Iid = Guid.Parse("b050b1f4-6f4d-4ee8-993b-6d3ae67bb2f0"), ShortName = "FT"
            };

            siteReferenceDataLibrary_2.FileType.Add(fileType);

            fileType.Category.Add(category);

            var result = this.categorizableThingRuleChecker.CheckWhetherReferencedCategoryIsInChainOfRdls(fileType).Single();

            Assert.That(result.Id, Is.EqualTo("MA-0200"));
            Assert.That(result.Description, Is.EqualTo("The ICategorizableThing is a member of Categories that are not in the chain of Reference Data Libraries: 0b8f399c-a1b2-4993-abc3-31f2ad880936:CAT"));
            Assert.That(result.Thing, Is.EqualTo(fileType));
            Assert.That(result.Severity, Is.EqualTo(SeverityKind.Error));

            var modelReferenceDataLibrary = new ModelReferenceDataLibrary();
            var engineeringModel          = new EngineeringModel();
            var engineeringModelSetup     = new EngineeringModelSetup();

            engineeringModel.EngineeringModelSetup = engineeringModelSetup;
            engineeringModelSetup.RequiredRdl.Add(modelReferenceDataLibrary);

            var iteration = new Iteration();

            engineeringModel.Iteration.Add(iteration);
            var elementDefinition = new ElementDefinition();

            iteration.Element.Add(elementDefinition);

            elementDefinition.Category.Add(category);

            result = this.categorizableThingRuleChecker.CheckWhetherReferencedCategoryIsInChainOfRdls(elementDefinition).Single();
            Assert.That(result.Id, Is.EqualTo("MA-0200"));
            Assert.That(result.Description, Is.EqualTo("The ICategorizableThing is a member of Categories that are not in the chain of Reference Data Libraries: 0b8f399c-a1b2-4993-abc3-31f2ad880936:CAT"));
            Assert.That(result.Thing, Is.EqualTo(elementDefinition));
            Assert.That(result.Severity, Is.EqualTo(SeverityKind.Error));
        }
Exemple #12
0
        public void SetUp()
        {
            this.thingDialognavigationService = new Mock <IThingDialogNavigationService>();
            this.cache             = new ConcurrentDictionary <CacheKey, Lazy <Thing> >();
            this.permissionService = new Mock <IPermissionService>();
            this.permissionService.Setup(x => x.CanRead(It.IsAny <Thing>())).Returns(true);
            this.permissionService.Setup(x => x.CanWrite(It.IsAny <Thing>())).Returns(true);

            this.session = new Mock <ISession>();
            this.session.Setup(x => x.PermissionService).Returns(this.permissionService.Object);

            this.activeDomain = new DomainOfExpertise(Guid.NewGuid(), null, this.uri)
            {
                Name = "active", ShortName = "active"
            };
            this.otherDomain = new DomainOfExpertise(Guid.NewGuid(), null, this.uri)
            {
                Name = "other", ShortName = "other"
            };

            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.session.Setup(x => x.OpenIterations).Returns(new Dictionary <Iteration, Tuple <DomainOfExpertise, Participant> >());

            this.engineeringModelSetup = new EngineeringModelSetup(Guid.NewGuid(), null, this.uri);
            this.engineeringModelSetup.Participant.Add(this.participant);

            this.siteDirectory    = new SiteDirectory(Guid.NewGuid(), this.cache, this.uri);
            this.engineeringModel = new EngineeringModel(Guid.NewGuid(), this.cache, this.uri);
            this.engineeringModel.EngineeringModelSetup = this.engineeringModelSetup;
            this.iteration                      = new Iteration(Guid.NewGuid(), this.cache, this.uri);
            this.elementDefinition              = new ElementDefinition(Guid.NewGuid(), this.cache, this.uri);
            this.otherElementDefinition         = new ElementDefinition(Guid.NewGuid(), this.cache, this.uri);
            this.elementUsage                   = new ElementUsage(Guid.NewGuid(), this.cache, this.uri);
            this.elementUsage.ElementDefinition = otherElementDefinition;
            this.elementDefinition.ContainedElement.Add(this.elementUsage);

            this.engineeringModel.Iteration.Add(this.iteration);
            this.iteration.Element.Add(this.elementDefinition);
            this.iteration.Element.Add(this.otherElementDefinition);
        }
Exemple #13
0
        public async Task VerifyThatCreateUserRuleVerificationExecutesWrite()
        {
            var engineeringModel = new EngineeringModel(Guid.NewGuid(), this.cache, null);
            var iteration        = new Iteration(Guid.NewGuid(), this.cache, null);

            engineeringModel.Iteration.Add(iteration);
            var ruleVerificationList = new RuleVerificationList(Guid.NewGuid(), this.cache, null);

            iteration.RuleVerificationList.Add(ruleVerificationList);

            var binaryRelationshipRule = new BinaryRelationshipRule(Guid.NewGuid(), this.cache, null);

            await this.thingCreator.CreateUserRuleVerification(ruleVerificationList, binaryRelationshipRule, this.session.Object);

            this.session.Verify(x => x.Write(It.IsAny <OperationContainer>()));
        }
Exemple #14
0
        public void VerifyThatExceptionIsThrownWhenCreateElementUsageFails()
        {
            var domainOfExpertise = new DomainOfExpertise(Guid.NewGuid(), this.cache, null);
            var engineeringModel  = new EngineeringModel(Guid.NewGuid(), this.cache, null);
            var iteration         = new Iteration(Guid.NewGuid(), this.cache, null);

            engineeringModel.Iteration.Add(iteration);

            var elementDefinitionA = new ElementDefinition(Guid.NewGuid(), this.cache, null);
            var elementDefinitionB = new ElementDefinition(Guid.NewGuid(), this.cache, null);

            iteration.Element.Add(elementDefinitionA);
            iteration.Element.Add(elementDefinitionB);

            Assert.ThrowsAsync <Exception>(async() => await this.thingCreator.CreateElementUsage(elementDefinitionA, elementDefinitionB, domainOfExpertise, this.sessionThatThrowsException.Object));
        }
        public void Setup()
        {
            RxApp.MainThreadScheduler = Scheduler.CurrentThread;
            this.uri                          = new Uri("http://www.rheagroup.com");
            this.session                      = new Mock <ISession>();
            this.serviceLocator               = new Mock <IServiceLocator>();
            this.navigationService            = new Mock <IPanelNavigationService>();
            this.thingDialogNavigationService = new Mock <IThingDialogNavigationService>();
            var siteDirectory = new SiteDirectory(Guid.NewGuid(), null, null);

            this.model          = new EngineeringModel(Guid.NewGuid(), null, this.uri);
            this.modelSetup     = new EngineeringModelSetup(Guid.NewGuid(), null, this.uri);
            this.iteration      = new Iteration(Guid.NewGuid(), null, this.uri);
            this.iterationSetup = new IterationSetup(Guid.NewGuid(), null, this.uri);
            this.person         = new Person(Guid.NewGuid(), null, this.uri)
            {
                GivenName = "John", Surname = "Doe"
            };


            this.model.Iteration.Add(this.iteration);
            this.model.EngineeringModelSetup = this.modelSetup;
            this.iteration.IterationSetup    = this.iterationSetup;
            this.modelSetup.IterationSetup.Add(this.iterationSetup);
            this.iterationSetup.Container = this.modelSetup;
            this.session.Setup(x => x.DataSourceUri).Returns(this.uri.ToString);
            this.session.Setup(x => x.RetrieveSiteDirectory()).Returns(siteDirectory);
            var openIterations = new Dictionary <Iteration, Tuple <DomainOfExpertise, Participant> >();

            this.session.Setup(x => x.OpenIterations).Returns(openIterations);
            this.session.Setup(x => x.ActivePerson).Returns(this.person);

            ServiceLocator.SetLocatorProvider(() => this.serviceLocator.Object);
            this.serviceLocator.Setup(x => x.GetInstance <IPanelNavigationService>())
            .Returns(this.navigationService.Object);

            this.permissionService = new Mock <IPermissionService>();
            this.permissionService.Setup(x => x.CanRead(It.IsAny <Thing>())).Returns(true);
            this.permissionService.Setup(x => x.CanWrite(It.IsAny <Thing>())).Returns(true);
            this.permissionService.Setup(x => x.CanWrite(It.IsAny <ClassKind>(), It.IsAny <Thing>())).Returns(true);

            ServiceLocator.SetLocatorProvider(() => this.serviceLocator.Object);
            this.serviceLocator.Setup(x => x.GetInstance <IPanelNavigationService>())
            .Returns(this.navigationService.Object);
            this.session.Setup(x => x.PermissionService).Returns(this.permissionService.Object);
            this.session.Setup(x => x.IsVersionSupported(It.IsAny <Version>())).Returns(true);
        }
Exemple #16
0
        public void SetUp()
        {
            this.uri   = new Uri("http://www.rheagroup.com");
            this.cache = new ConcurrentDictionary <CacheKey, Lazy <CDP4Common.CommonData.Thing> >();

            this.siteDirectory = new SiteDirectory(Guid.NewGuid(), this.cache, this.uri);
            var siteReferenceDataLibrary = new SiteReferenceDataLibrary(Guid.NewGuid(), this.cache, this.uri);

            this.siteDirectory.SiteReferenceDataLibrary.Add(siteReferenceDataLibrary);
            this.textParameterType = new TextParameterType(Guid.NewGuid(), this.cache, this.uri);
            siteReferenceDataLibrary.ParameterType.Add(this.textParameterType);

            this.engineeringModel = new EngineeringModel(Guid.NewGuid(), this.cache, this.uri);
            this.engineeringModel.RevisionNumber = 2;

            var frozenIterationSetup = new IterationSetup(Guid.NewGuid(), this.cache, this.uri);

            frozenIterationSetup.FrozenOn = DateTime.Parse("2012-12-12");

            this.frozenIteration = new Iteration(Guid.NewGuid(), this.cache, this.uri);
            this.frozenIteration.RevisionNumber = 1;
            this.frozenIteration.IterationSetup = frozenIterationSetup;

            var activeIterationSetup = new IterationSetup(Guid.NewGuid(), this.cache, this.uri);

            this.activeIteration = new Iteration(Guid.NewGuid(), this.cache, this.uri);
            this.activeIteration.RevisionNumber = 2;
            this.activeIteration.IterationSetup = activeIterationSetup;

            this.engineeringModel.Iteration.Add(this.frozenIteration);
            this.engineeringModel.Iteration.Add(this.activeIteration);

            var frozenElementDefinitionIid = Guid.NewGuid();

            this.frozenElementDefinition = new ElementDefinition(frozenElementDefinitionIid, this.cache, this.uri);
            this.frozenElementDefinition.RevisionNumber = 1;
            this.frozenIteration.Element.Add(this.frozenElementDefinition);

            var activeElementDefinitionIid = Guid.NewGuid();

            this.activeElementDefinition = new ElementDefinition(activeElementDefinitionIid, this.cache, this.uri);
            this.activeElementDefinition.RevisionNumber = 2;
            this.activeIteration.Element.Add(this.activeElementDefinition);

            this.book = new Book(Guid.NewGuid(), this.cache, this.uri);
            this.engineeringModel.Book.Add(this.book);
        }
        public void SetUp()
        {
            this.userRuleVerificationRuleChecker = new UserRuleVerificationRuleChecker();

            this.modelReferenceDataLibrary = new ModelReferenceDataLibrary();
            this.engineeringModelSetup     = new EngineeringModelSetup();
            this.engineeringModel          = new EngineeringModel();
            this.iteration            = new Iteration();
            this.ruleVerificationList = new RuleVerificationList();
            this.userRuleVerification = new UserRuleVerification();

            this.engineeringModelSetup.RequiredRdl.Add(this.modelReferenceDataLibrary);
            this.engineeringModel.EngineeringModelSetup = this.engineeringModelSetup;
            this.engineeringModel.Iteration.Add(this.iteration);
            this.iteration.RuleVerificationList.Add(this.ruleVerificationList);
            this.ruleVerificationList.RuleVerification.Add(this.userRuleVerification);
        }
        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.systemEngineering  = new DomainOfExpertise(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);
            var parameterSubscription = new ParameterSubscription(Guid.NewGuid(), this.cache, this.uri)
            {
                Owner = this.systemEngineering
            };

            parameter.ParameterSubscription.Add(parameterSubscription);

            this.session = new Mock <ISession>();
            this.session.Setup(x => x.QuerySelectedDomainOfExpertise(this.iteration)).Returns(this.systemEngineering);

            this.parameterSubscriptionBatchService = new ParameterSubscriptionBatchService();
        }
        public void SetUp()
        {
            this.iterationRuleChecker = new IterationRuleChecker();

            this.engineeringModelSetup = new EngineeringModelSetup();
            this.iterationSetup        = new IterationSetup();
            this.engineeringModelSetup.IterationSetup.Add(iterationSetup);

            this.engineeringModel = new EngineeringModel();
            this.iteration        = new Iteration {
                Iid = Guid.Parse("37076675-f0cd-47e8-8ab4-1d2e7025f591")
            };
            this.engineeringModel.Iteration.Add(iteration);

            this.engineeringModel.EngineeringModelSetup = this.engineeringModelSetup;
            this.iteration.IterationSetup = this.iterationSetup;
        }
Exemple #20
0
        public async Task VerifyThatCreateParameterWriteExceptionsAreThrown()
        {
            var engineeringModel = new EngineeringModel(Guid.NewGuid(), this.cache, null);
            var iteration        = new Iteration(Guid.NewGuid(), this.cache, null);

            engineeringModel.Iteration.Add(iteration);

            var elementDefinition = new ElementDefinition(Guid.NewGuid(), this.cache, null);

            iteration.Element.Add(elementDefinition);

            var parameterType     = new BooleanParameterType(Guid.NewGuid(), this.cache, null);
            var domainOfExpertise = new DomainOfExpertise(Guid.NewGuid(), this.cache, null);

            this.cache.TryAdd(new CacheKey(elementDefinition.Iid, iteration.Iid), new Lazy <Thing>(() => elementDefinition));
            Assert.ThrowsAsync <Exception>(async() => await this.thingCreator.CreateParameter(elementDefinition, null, parameterType, null, domainOfExpertise, this.sessionThatThrowsException.Object));
        }
Exemple #21
0
        public void SetUp()
        {
            this.fileRevisionRuleChecker = new FileRevisionRuleChecker();

            this.modelReferenceDataLibrary = new ModelReferenceDataLibrary();
            this.engineeringModelSetup     = new EngineeringModelSetup();
            this.engineeringModel          = new EngineeringModel();
            this.commonFileStore           = new CommonFileStore();
            this.file         = new File();
            this.fileRevision = new FileRevision();

            this.engineeringModelSetup.RequiredRdl.Add(this.modelReferenceDataLibrary);
            this.engineeringModel.EngineeringModelSetup = this.engineeringModelSetup;
            this.engineeringModel.CommonFileStore.Add(commonFileStore);
            this.commonFileStore.File.Add(this.file);
            this.file.FileRevision.Add(this.fileRevision);
        }
        public async Task VerifyThatModelIsDeletedWhenSetupIsDeleted()
        {
            var assembler = new Assembler(this.uri);

            var model = new EngineeringModel(Guid.NewGuid(), assembler.Cache, this.uri);
            var it1   = new Iteration(Guid.NewGuid(), assembler.Cache, this.uri);
            var it2   = new Iteration(Guid.NewGuid(), assembler.Cache, this.uri);

            model.Iteration.Add(it1);
            model.Iteration.Add(it2);

            var sitedir    = new SiteDirectory(Guid.NewGuid(), assembler.Cache, this.uri);
            var modelsetup = new EngineeringModelSetup(Guid.NewGuid(), assembler.Cache, this.uri)
            {
                EngineeringModelIid = model.Iid
            };
            var iterationsetup1 = new IterationSetup(Guid.NewGuid(), assembler.Cache, this.uri)
            {
                IterationIid = it1.Iid
            };
            var iterationsetup2 = new IterationSetup(Guid.NewGuid(), assembler.Cache, this.uri)
            {
                IterationIid = it2.Iid
            };

            sitedir.Model.Add(modelsetup);
            modelsetup.IterationSetup.Add(iterationsetup1);
            modelsetup.IterationSetup.Add(iterationsetup2);

            assembler.Cache.TryAdd(new CacheKey(sitedir.Iid, null), new Lazy <Thing>(() => sitedir));
            assembler.Cache.TryAdd(new CacheKey(modelsetup.Iid, null), new Lazy <Thing>(() => modelsetup));
            assembler.Cache.TryAdd(new CacheKey(iterationsetup1.Iid, null), new Lazy <Thing>(() => iterationsetup1));
            assembler.Cache.TryAdd(new CacheKey(iterationsetup2.Iid, null), new Lazy <Thing>(() => iterationsetup2));
            assembler.Cache.TryAdd(new CacheKey(model.Iid, null), new Lazy <Thing>(() => model));
            assembler.Cache.TryAdd(new CacheKey(it1.Iid, null), new Lazy <Thing>(() => it1));
            assembler.Cache.TryAdd(new CacheKey(it2.Iid, null), new Lazy <Thing>(() => it2));

            var sitedirdto = new Dto.SiteDirectory(sitedir.Iid, 1);

            Assert.AreEqual(7, assembler.Cache.Count);
            await assembler.Synchronize(new List <Dto.Thing> {
                sitedirdto
            });

            Assert.AreEqual(1, assembler.Cache.Count);
        }
Exemple #23
0
        public void Setup()
        {
            this.serviceLocator               = new Mock <IServiceLocator>();
            this.permissionService            = new Mock <IPermissionService>();
            this.panelNavigationService       = new Mock <IPanelNavigationService>();
            this.thingDialogNavigationService = new Mock <IThingDialogNavigationService>();
            this.session   = new Mock <ISession>();
            this.assembler = new Assembler(this.uri);

            this.session2   = new Mock <ISession>();
            this.assembler2 = new Assembler(this.uri2);

            ServiceLocator.SetLocatorProvider(() => this.serviceLocator.Object);
            this.serviceLocator.Setup(x => x.GetInstance <IPermissionService>()).Returns(this.permissionService.Object);
            this.serviceLocator.Setup(x => x.GetInstance <IPanelNavigationService>()).Returns(this.panelNavigationService.Object);
            this.serviceLocator.Setup(x => x.GetInstance <IThingDialogNavigationService>()).Returns(this.thingDialogNavigationService.Object);

            this.siteDir        = new SiteDirectory(Guid.NewGuid(), this.assembler.Cache, this.uri);
            this.person         = new Person(Guid.NewGuid(), this.assembler.Cache, this.uri);
            this.model          = new EngineeringModel(Guid.NewGuid(), this.assembler.Cache, this.uri);
            this.modelSetup     = new EngineeringModelSetup(Guid.NewGuid(), this.assembler.Cache, this.uri);
            this.iteration      = new Iteration(Guid.NewGuid(), this.assembler.Cache, this.uri);
            this.iteration2     = new Iteration(Guid.NewGuid(), this.assembler2.Cache, this.uri2);
            this.iterationSetup = new IterationSetup(Guid.NewGuid(), this.assembler.Cache, this.uri);
            this.participant    = new Participant(Guid.NewGuid(), this.assembler.Cache, this.uri);
            this.option         = new Option(Guid.NewGuid(), this.assembler.Cache, this.uri);

            this.siteDir.Person.Add(this.person);
            this.siteDir.Model.Add(this.modelSetup);
            this.modelSetup.IterationSetup.Add(this.iterationSetup);
            this.modelSetup.Participant.Add(this.participant);
            this.participant.Person = this.person;

            this.model.Iteration.Add(this.iteration);
            this.model.Iteration.Add(this.iteration2);
            this.model.EngineeringModelSetup = this.modelSetup;
            this.iteration.IterationSetup    = this.iterationSetup;
            this.iteration.Option.Add(this.option);
            this.iteration2.IterationSetup = this.iterationSetup;
            this.iteration2.Option.Add(this.option);

            this.session.Setup(x => x.ActivePerson).Returns(this.person);
            this.session.Setup(x => x.DataSourceUri).Returns(this.uri.ToString);
            this.session.Setup(x => x.Assembler).Returns(this.assembler);
            this.session2.Setup(x => x.Assembler).Returns(this.assembler2);
        }
Exemple #24
0
        public void SetUp()
        {
            this.parameterBaseRuleChecker = new ParameterBaseRuleChecker();

            this.modelReferenceDataLibrary = new ModelReferenceDataLibrary();
            this.engineeringModelSetup     = new EngineeringModelSetup();
            this.engineeringModel          = new EngineeringModel();
            this.iteration         = new Iteration();
            this.elementDefinition = new ElementDefinition();
            this.parameter         = new Parameter();

            this.engineeringModelSetup.RequiredRdl.Add(this.modelReferenceDataLibrary);
            this.engineeringModel.EngineeringModelSetup = this.engineeringModelSetup;
            this.engineeringModel.Iteration.Add(this.iteration);
            this.iteration.Element.Add(this.elementDefinition);
            this.elementDefinition.Parameter.Add(this.parameter);
        }
        public void SetUp()
        {
            RxApp.MainThreadScheduler = Scheduler.CurrentThread;
            this.permissionService    = new Mock <IPermissionService>();
            this.thingCreator         = new Mock <IThingCreator>();
            this.cache = new ConcurrentDictionary <CacheKey, Lazy <Thing> >();

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

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

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

            this.modelsetup     = new EngineeringModelSetup(Guid.NewGuid(), this.cache, this.uri);
            this.iterationsetup = new IterationSetup(Guid.NewGuid(), this.cache, this.uri);

            this.modelsetup.IterationSetup.Add(this.iterationsetup);

            this.session = new Mock <ISession>();

            this.model = new EngineeringModel(Guid.NewGuid(), this.cache, this.uri)
            {
                EngineeringModelSetup = this.modelsetup
            };
            this.iteration = new Iteration(Guid.NewGuid(), this.cache, this.uri)
            {
                IterationSetup = this.iterationsetup
            };
            var person = new Person(Guid.NewGuid(), null, null)
            {
                GivenName = "test", Surname = "test"
            };

            this.session.Setup(x => x.ActivePerson).Returns(person);

            this.model.Iteration.Add(this.iteration);

            this.session.Setup(x => x.PermissionService).Returns(this.permissionService.Object);
            this.session.Setup(x => x.OpenIterations).Returns(new Dictionary <Iteration, Tuple <DomainOfExpertise, Participant> >());

            this.fileStoreRow  = new Mock <IFileStoreRow <FileStore> >();
            this.containedRows = new DisposableReactiveList <IRowViewModelBase <Thing> >();
            this.fileStoreRow.Setup(x => x.ContainedRows).Returns(this.containedRows);
            this.fileStoreRow.Setup(x => x.Session).Returns(this.session.Object);
        }
        public void Setup()
        {
            RxApp.MainThreadScheduler = Scheduler.CurrentThread;

            this.uri            = new Uri("http://www.rheagroup.com");
            this.cache          = new ConcurrentDictionary <CacheKey, Lazy <Thing> >();
            this.serviceLocator = new Mock <IServiceLocator>();
            this.navigation     = new Mock <IThingDialogNavigationService>();
            ServiceLocator.SetLocatorProvider(() => this.serviceLocator.Object);
            this.serviceLocator.Setup(x => x.GetInstance <IThingDialogNavigationService>()).Returns(this.navigation.Object);
            this.permissionService = new Mock <IPermissionService>();
            this.permissionService.Setup(x => x.CanWrite(It.IsAny <Thing>())).Returns(true);

            this.session = new Mock <ISession>();
            var person = new Person(Guid.NewGuid(), this.cache, this.uri)
            {
                Container = this.siteDir
            };

            this.session.Setup(x => x.ActivePerson).Returns(person);
            this.session.Setup(x => x.PermissionService).Returns(this.permissionService.Object);

            this.siteDir = new SiteDirectory(Guid.NewGuid(), this.cache, this.uri);
            this.siteDir.Person.Add(person);

            this.model     = new EngineeringModel(Guid.NewGuid(), this.cache, this.uri);
            this.iteration = new Iteration(Guid.NewGuid(), this.cache, this.uri);

            this.model.Iteration.Add(this.iteration);

            var transactionContext = TransactionContextResolver.ResolveContext(this.iteration);

            this.transaction = new ThingTransaction(transactionContext, null);

            this.session.Setup(x => x.RetrieveSiteDirectory()).Returns(this.siteDir);
            this.session.Setup(x => x.OpenReferenceDataLibraries).Returns(new HashSet <ReferenceDataLibrary>(this.siteDir.SiteReferenceDataLibrary));

            var dal = new Mock <IDal>();

            this.session.Setup(x => x.DalVersion).Returns(new Version(1, 1, 0));
            this.session.Setup(x => x.Dal).Returns(dal.Object);
            dal.Setup(x => x.MetaDataProvider).Returns(new MetaDataProvider());

            this.cache.TryAdd(new CacheKey(this.iteration.Iid, null), new Lazy <Thing>(() => this.iteration));
        }
Exemple #27
0
        /// <summary>
        /// Executes the Select command
        /// </summary>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        private async Task ExecuteSelect()
        {
            var tasks     = new List <Task>();
            var stopWatch = Stopwatch.StartNew();

            // this.SelectedITeration should only contain ModelSelectionIterationSetupRowViewModel as the items are filtered
            foreach (var setupRow in this.SelectedIterations)
            {
                var iterationSetupRow = setupRow as ModelSelectionIterationSetupRowViewModel;

                if (iterationSetupRow == null)
                {
                    throw new NullReferenceException("The selected row was not of the correct type.");
                }

                var modelSetup = iterationSetupRow.Thing.Container as EngineeringModelSetup;

                if (modelSetup == null)
                {
                    throw new NullReferenceException(string.Format("The EngineeringModelSetup that iteration {0} belongs to cannot be found.", iterationSetupRow.Thing.Iid));
                }

                // Retrieve the Iteration from the IDal
                var session = iterationSetupRow.Session;
                var model   = new EngineeringModel(modelSetup.EngineeringModelIid, session.Assembler.Cache, session.Credentials.Uri)
                {
                    EngineeringModelSetup = modelSetup
                };

                var iteration = new Iteration(iterationSetupRow.Thing.IterationIid, session.Assembler.Cache, session.Credentials.Uri);

                model.Iteration.Add(iteration);
                tasks.Add(session.Read(iteration, iterationSetupRow.SelectedDomain));
            }

            this.IsBusy         = true;
            this.LoadingMessage = "Loading Iterations...";
            await Task.WhenAll(tasks);

            this.IsBusy = false;
            stopWatch.Stop();
            logger.Info("Loading model took {0}", stopWatch.Elapsed);

            this.DialogResult = new BaseDialogResult(true);
        }
Exemple #28
0
        public void Setup()
        {
            this.thingDialogNavigationService = new Mock <IThingDialogNavigationService>();
            this.session           = new Mock <ISession>();
            this.permissionService = new Mock <IPermissionService>();
            this.cache             = new ConcurrentDictionary <CacheKey, Lazy <Thing> >();

            this.option    = new Option(Guid.NewGuid(), this.cache, null);
            this.iteration = new Iteration(Guid.NewGuid(), this.cache, null);
            this.iteration.Option.Add(this.option);
            this.iteration.DefaultOption = this.option;
            this.model = new EngineeringModel(Guid.NewGuid(), this.cache, null);

            this.sitedir = new SiteDirectory(Guid.NewGuid(), this.cache, null);
            this.srdl    = new SiteReferenceDataLibrary(Guid.NewGuid(), this.cache, null);
            this.mrdl    = new ModelReferenceDataLibrary(Guid.NewGuid(), this.cache, null)
            {
                RequiredRdl = this.srdl
            };
            this.modelsetup = new EngineeringModelSetup(Guid.NewGuid(), this.cache, null);
            this.modelsetup.RequiredRdl.Add(this.mrdl);
            this.cat1 = new Category(Guid.NewGuid(), this.cache, null);
            this.cat1.PermissibleClass.Add(ClassKind.Option);

            this.sitedir.SiteReferenceDataLibrary.Add(this.srdl);
            this.srdl.DefinedCategory.Add(this.cat1);

            this.model.EngineeringModelSetup = this.modelsetup;
            this.model.Iteration.Add(this.iteration);
            this.session.Setup(x => x.RetrieveSiteDirectory()).Returns(this.sitedir);

            this.cache.TryAdd(new CacheKey(this.iteration.Iid, null), new Lazy <Thing>(() => this.iteration));

            this.iterationClone = this.iteration.Clone(false);

            var transactionContext = TransactionContextResolver.ResolveContext(this.iteration);

            this.thingTransaction = new ThingTransaction(transactionContext, this.iterationClone);

            var dal = new Mock <IDal>();

            this.session.Setup(x => x.DalVersion).Returns(new Version(1, 1, 0));
            this.session.Setup(x => x.Dal).Returns(dal.Object);
            dal.Setup(x => x.MetaDataProvider).Returns(new MetaDataProvider());
        }
Exemple #29
0
        public void VerifyRuleCheckerErrorRowViewModelCanBeCreated()
        {
            var thing     = new ElementDefinition(Guid.NewGuid(), null, null);
            var container = new EngineeringModel(Guid.NewGuid(), null, null);


            var iteration = new Iteration(Guid.NewGuid(), null, null);

            container.Iteration.Add(iteration);
            iteration.Element.Add(thing);

            Assert.IsNotNull(thing.TopContainer);

            var vm = new RuleCheckerErrorRowViewModel(thing, thing.Iid.ToString(), "description", SeverityKind.Error);

            Assert.IsNotNull(vm.ToString());
            Assert.IsTrue(vm.ToString().Contains($"({thing.Iid})"));
        }
Exemple #30
0
        public async Task VerifyThatCreateElementUsageExecutesWrite()
        {
            var domainOfExpertise = new DomainOfExpertise(Guid.NewGuid(), this.cache, null);
            var engineeringModel  = new EngineeringModel(Guid.NewGuid(), this.cache, null);
            var iteration         = new Iteration(Guid.NewGuid(), this.cache, null);

            engineeringModel.Iteration.Add(iteration);

            var elementDefinitionA = new ElementDefinition(Guid.NewGuid(), this.cache, null);
            var elementDefinitionB = new ElementDefinition(Guid.NewGuid(), this.cache, null);

            iteration.Element.Add(elementDefinitionA);
            iteration.Element.Add(elementDefinitionB);

            await this.thingCreator.CreateElementUsage(elementDefinitionA, elementDefinitionB, domainOfExpertise, this.session.Object);

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