public void VerifyThatCategoriesFromExistingRdlsAreLoaded() { var siterefenceDataLibrary = new SiteReferenceDataLibrary(Guid.NewGuid(), null, null); var glossary1 = new Glossary(Guid.NewGuid(), null, null); var glossary2 = new Glossary(Guid.NewGuid(), null, null); siterefenceDataLibrary.Glossary.Add(glossary1); siterefenceDataLibrary.Glossary.Add(glossary2); this.siteDirectory.SiteReferenceDataLibrary.Add(siterefenceDataLibrary); var engineeringModelSetup = new EngineeringModelSetup(Guid.NewGuid(), null, null); var modelReferenceDataLibrary = new ModelReferenceDataLibrary(Guid.NewGuid(), null, null); var glossary3 = new Glossary(Guid.NewGuid(), null, null); var glossary4 = new Glossary(Guid.NewGuid(), null, null); modelReferenceDataLibrary.Glossary.Add(glossary3); modelReferenceDataLibrary.Glossary.Add(glossary4); engineeringModelSetup.RequiredRdl.Add(modelReferenceDataLibrary); this.siteDirectory.Model.Add(engineeringModelSetup); this.session.Setup(x => x.OpenReferenceDataLibraries).Returns(new HashSet <ReferenceDataLibrary>(this.siteDirectory.SiteReferenceDataLibrary) { modelReferenceDataLibrary }); var browser = new GlossaryBrowserViewModel(this.session.Object, this.siteDirectory, null, null, null, null); Assert.AreEqual(4, browser.Glossaries.Count); }
/// <summary> /// Updates the <see cref="Transaction"/> with the changes recorded in the current view-model /// </summary> protected override void UpdateTransaction() { base.UpdateTransaction(); if (this.dialogKind.Equals(ThingDialogKind.Update)) { return; } // set the source SourceEngineeringModelSetup if the model is derived, otherwise set the Required RDL if (this.SourceEngineeringModelSetup == null) { this.Thing.SourceEngineeringModelSetupIid = null; this.Thing.RequiredRdl.Clear(); // this is a non-derived EMS thus a new engineering model rdl has to be passed in as well var mrdl = new ModelReferenceDataLibrary(); mrdl.Name = string.Concat(this.Name, " Model RDL"); mrdl.ShortName = string.Concat(this.ShortName, "MRDL"); mrdl.RequiredRdl = this.SelectedSiteReferenceDataLibrary; this.Thing.RequiredRdl.Add(mrdl); this.transaction.Create(mrdl); } else { if (this.SourceEngineeringModelSetup != null) { this.Thing.SourceEngineeringModelSetupIid = this.SourceEngineeringModelSetup.Iid; } } this.Thing.EngineeringModelIid = Guid.NewGuid(); }
public void VerifyThatPossibleContainerRdlsGetPopulated() { var siteRdl = new SiteReferenceDataLibrary() { ShortName = "GenericRDL" }; this.siteDirectory.SiteReferenceDataLibrary.Add(siteRdl); var modelRdl = new ModelReferenceDataLibrary() { ShortName = "ModelRDL" }; modelRdl.RequiredRdl = siteRdl; var openRdls = new List <ReferenceDataLibrary> { siteRdl, modelRdl }; this.session.Setup(x => x.OpenReferenceDataLibraries).Returns(openRdls); this.viewmodel = new ReferenceSourceDialogViewModel(this.referenceSource, this.transaction, this.session.Object, true, ThingDialogKind.Create, null, null, null); Assert.AreEqual(2, this.viewmodel.PossibleContainer.Count); Assert.AreEqual(siteRdl.ShortName, ((SiteReferenceDataLibrary)this.viewmodel.Container).ShortName); }
public void VerifyThatCategoriesFromExistingRdlsAreLoaded() { var siterefenceDataLibrary = new SiteReferenceDataLibrary(Guid.NewGuid(), null, null); var rule1 = new BinaryRelationshipRule(Guid.NewGuid(), null, null); var rule2 = new MultiRelationshipRule(Guid.NewGuid(), null, null); siterefenceDataLibrary.Rule.Add(rule1); siterefenceDataLibrary.Rule.Add(rule2); this.siteDir.SiteReferenceDataLibrary.Add(siterefenceDataLibrary); var engineeringModelSetup = new EngineeringModelSetup(Guid.NewGuid(), null, null); var modelReferenceDataLibrary = new ModelReferenceDataLibrary(Guid.NewGuid(), null, null); var rule3 = new BinaryRelationshipRule(Guid.NewGuid(), null, null); var rule4 = new MultiRelationshipRule(Guid.NewGuid(), null, null); modelReferenceDataLibrary.Rule.Add(rule3); modelReferenceDataLibrary.Rule.Add(rule4); engineeringModelSetup.RequiredRdl.Add(modelReferenceDataLibrary); this.siteDir.Model.Add(engineeringModelSetup); this.session.Setup(x => x.OpenReferenceDataLibraries).Returns(new HashSet <ReferenceDataLibrary>(this.siteDir.SiteReferenceDataLibrary) { modelReferenceDataLibrary }); var browser = new RulesBrowserViewModel(this.session.Object, this.siteDir, null, null, null, null); Assert.AreEqual(4, browser.Rules.Count); }
public void VerifyThatParametertypesFromExistingRdlsAreLoaded() { var siterefenceDataLibrary = new SiteReferenceDataLibrary(Guid.NewGuid(), null, null); var pt1 = new TextParameterType(Guid.NewGuid(), null, null); var pt2 = new TextParameterType(Guid.NewGuid(), null, null); siterefenceDataLibrary.ParameterType.Add(pt1); siterefenceDataLibrary.ParameterType.Add(pt2); this.siteDirectory.SiteReferenceDataLibrary.Add(siterefenceDataLibrary); var engineeringModelSetup = new EngineeringModelSetup(Guid.NewGuid(), null, null); var modelReferenceDataLibrary = new ModelReferenceDataLibrary(Guid.NewGuid(), null, null); var pt3 = new BooleanParameterType(Guid.NewGuid(), null, null); var pt4 = new BooleanParameterType(Guid.NewGuid(), null, null); modelReferenceDataLibrary.ParameterType.Add(pt3); modelReferenceDataLibrary.ParameterType.Add(pt4); engineeringModelSetup.RequiredRdl.Add(modelReferenceDataLibrary); this.siteDirectory.Model.Add(engineeringModelSetup); this.session.Setup(x => x.OpenReferenceDataLibraries).Returns( new HashSet <ReferenceDataLibrary>(this.siteDirectory.SiteReferenceDataLibrary) { modelReferenceDataLibrary }); var browser = new ParameterTypesBrowserViewModel(this.session.Object, this.siteDirectory, null, null, null, null, this.favoritesService.Object); Assert.AreEqual(4, browser.ParameterTypes.Count); Assert.IsNotNull(browser.ParameterTypes.First().Thing); browser.Dispose(); Assert.IsNull(browser.ParameterTypes.First().Thing); }
public void Setup() { this.siteReferenceDataLibraryDao = new Mock <ISiteReferenceDataLibraryDao>(); this.engineeringModelSetupDao = new Mock <IEngineeringModelSetupDao>(); this.modelReferenceDataLibraryDao = new Mock <IModelReferenceDataLibraryDao>(); this.transactionManager = new Mock <ICdp4TransactionManager>(); this.transactionManager.Setup(x => x.IsFullAccessEnabled()).Returns(true); this.modelReferenceDataLibraryService = new ModelReferenceDataLibraryService { EngineeringModelSetupDao = this.engineeringModelSetupDao.Object, SiteReferenceDataLibraryDao = this.siteReferenceDataLibraryDao.Object, ModelReferenceDataLibraryDao = this.modelReferenceDataLibraryDao.Object, TransactionManager = this.transactionManager.Object }; this.siteReferenceDataLibrary1 = new SiteReferenceDataLibrary(Guid.NewGuid(), 0); this.siteReferenceDataLibrary2 = new SiteReferenceDataLibrary(Guid.NewGuid(), 0); this.modelReferenceDataLibrary = new ModelReferenceDataLibrary(Guid.NewGuid(), 0); this.iteration = new Iteration(Guid.NewGuid(), 0); this.iterationSetup = new IterationSetup(Guid.NewGuid(), 0); this.engineeringModelSetup = new EngineeringModelSetup(Guid.NewGuid(), 0); this.iteration.IterationSetup = this.iterationSetup.Iid; this.engineeringModelSetup.IterationSetup.Add(this.iterationSetup.Iid); }
public void VerifyThatModelSetupIsCopiedCorrectly() { var modelSetup = new EngineeringModelSetup(Guid.NewGuid(), 0); var mrdl = new ModelReferenceDataLibrary(Guid.NewGuid(), 0); var cat = new Category(Guid.NewGuid(), 0); var participant = new Participant(Guid.NewGuid(), 0) { Person = Guid.NewGuid(), Role = Guid.NewGuid() }; var iterationSetup = new IterationSetup(Guid.NewGuid(), 0); participant.Domain.Add(Guid.NewGuid()); mrdl.DefinedCategory.Add(cat.Iid); mrdl.RequiredRdl = Guid.NewGuid(); modelSetup.RequiredRdl.Add(mrdl.Iid); modelSetup.IterationSetup.Add(iterationSetup.Iid); modelSetup.Participant.Add(participant.Iid); this.modelSetupService.Setup(x => x.GetDeep(It.IsAny <NpgsqlTransaction>(), "SiteDirectory", It.Is <IEnumerable <Guid> >(y => y.Contains(modelSetup.Iid)), It.IsAny <ISecurityContext>())). Returns(new Thing[] { modelSetup, mrdl, cat, participant, iterationSetup }); var copy = new EngineeringModelSetup(Guid.NewGuid(), 0); this.modelCreatorManager.CreateEngineeringModelSetupFromSource(modelSetup.Iid, copy, null, null); Assert.IsNotEmpty(copy.RequiredRdl); Assert.IsNotEmpty(copy.IterationSetup); Assert.IsNotEmpty(copy.Participant); }
public void VerifyThatScalesFromExistingRdlsAreLoaded() { var siterefenceDataLibrary = new SiteReferenceDataLibrary(Guid.NewGuid(), null, null); var ratioscale1 = new RatioScale(Guid.NewGuid(), null, null); var ratioscale2 = new RatioScale(Guid.NewGuid(), null, null); siterefenceDataLibrary.Scale.Add(ratioscale1); siterefenceDataLibrary.Scale.Add(ratioscale2); this.siteDirectory.SiteReferenceDataLibrary.Add(siterefenceDataLibrary); var engineeringModelSetup = new EngineeringModelSetup(Guid.NewGuid(), null, null); var modelReferenceDataLibrary = new ModelReferenceDataLibrary(Guid.NewGuid(), null, null); var ratioscale3 = new RatioScale(Guid.NewGuid(), null, null); var ratioscale4 = new RatioScale(Guid.NewGuid(), null, null); modelReferenceDataLibrary.Scale.Add(ratioscale3); modelReferenceDataLibrary.Scale.Add(ratioscale4); engineeringModelSetup.RequiredRdl.Add(modelReferenceDataLibrary); this.siteDirectory.Model.Add(engineeringModelSetup); this.session.Setup(x => x.OpenReferenceDataLibraries).Returns(new HashSet <ReferenceDataLibrary>(this.siteDirectory.SiteReferenceDataLibrary) { modelReferenceDataLibrary }); var browser = new MeasurementScalesBrowserViewModel(this.session.Object, this.siteDirectory, null, null, null, null); Assert.AreEqual(4, browser.MeasurementScales.Count); browser.Dispose(); Assert.IsNull(browser.MeasurementScales.First().Thing); }
public void VerifyThatRequiredRdlRdlsReturnsExpectedResult() { var genericRdl = new SiteReferenceDataLibrary(); var familyofRdl = new SiteReferenceDataLibrary(); familyofRdl.RequiredRdl = genericRdl; var modelrdl = new ModelReferenceDataLibrary(); modelrdl.RequiredRdl = familyofRdl; var iteration = new Iteration(); var engineeringModel = new EngineeringModel(); engineeringModel.Iteration.Add(iteration); var engineeringModelSetup = new EngineeringModelSetup(); var iterationSetup = new IterationSetup(); engineeringModelSetup.RequiredRdl.Add(modelrdl); engineeringModelSetup.IterationSetup.Add(iterationSetup); iteration.IterationSetup = iterationSetup; var requiredRdls = iteration.RequiredRdls; CollectionAssert.Contains(requiredRdls, genericRdl); CollectionAssert.Contains(requiredRdls, familyofRdl); CollectionAssert.Contains(requiredRdls, modelrdl); Assert.AreEqual(3, requiredRdls.Count()); }
public void VerifyThatConstantsFromExistingRdlsAreLoaded() { var siterefenceDataLibrary = new SiteReferenceDataLibrary(Guid.NewGuid(), null, null); var constant1 = new Constant(Guid.NewGuid(), null, null); var constant2 = new Constant(Guid.NewGuid(), null, null); siterefenceDataLibrary.Constant.Add(constant1); siterefenceDataLibrary.Constant.Add(constant2); this.siteDirectory.SiteReferenceDataLibrary.Add(siterefenceDataLibrary); var engineeringModelSetup = new EngineeringModelSetup(Guid.NewGuid(), null, null); var modelReferenceDataLibrary = new ModelReferenceDataLibrary(Guid.NewGuid(), null, null); var constant3 = new Constant(Guid.NewGuid(), null, null); var constant4 = new Constant(Guid.NewGuid(), null, null); modelReferenceDataLibrary.Constant.Add(constant3); modelReferenceDataLibrary.Constant.Add(constant4); engineeringModelSetup.RequiredRdl.Add(modelReferenceDataLibrary); this.siteDirectory.Model.Add(engineeringModelSetup); this.openRdlList = new List <ReferenceDataLibrary>(this.siteDirectory.SiteReferenceDataLibrary) { modelReferenceDataLibrary }; this.session.Setup(x => x.OpenReferenceDataLibraries).Returns(new HashSet <ReferenceDataLibrary>(this.openRdlList)); var browser = new ConstantsBrowserViewModel(this.session.Object, this.siteDirectory, null, null, null, null); Assert.AreEqual(4, browser.Constants.Count); }
public void VerifyThatUnitsFromExistingRdlsAreLoaded() { var siterefenceDataLibrary = new SiteReferenceDataLibrary(Guid.NewGuid(), null, null); var unit1 = new SimpleUnit(Guid.NewGuid(), null, null); var unit2 = new SimpleUnit(Guid.NewGuid(), null, null); siterefenceDataLibrary.Unit.Add(unit1); siterefenceDataLibrary.Unit.Add(unit2); this.siteDir.SiteReferenceDataLibrary.Add(siterefenceDataLibrary); var engineeringModelSetup = new EngineeringModelSetup(Guid.NewGuid(), null, null); var modelReferenceDataLibrary = new ModelReferenceDataLibrary(Guid.NewGuid(), null, null); var unit3 = new SimpleUnit(Guid.NewGuid(), null, null); var unit4 = new SimpleUnit(Guid.NewGuid(), null, null); modelReferenceDataLibrary.Unit.Add(unit3); modelReferenceDataLibrary.Unit.Add(unit4); engineeringModelSetup.RequiredRdl.Add(modelReferenceDataLibrary); this.siteDir.Model.Add(engineeringModelSetup); this.session.Setup(x => x.OpenReferenceDataLibraries).Returns(new HashSet <ReferenceDataLibrary>(this.siteDir.SiteReferenceDataLibrary) { modelReferenceDataLibrary }); var browser = new MeasurementUnitsBrowserViewModel(this.session.Object, this.siteDir, null, null, null, null); Assert.AreEqual(4, browser.MeasurementUnits.Count); }
public void VerifyAddGlossary() { Assert.IsFalse(this.glossaryBrowser.Glossaries.Any()); var glossary = new Glossary(Guid.NewGuid(), this.assembler.Cache, this.uri) { Name = "test Glossary", ShortName = "TG" }; this.srdl.Glossary.Add(glossary); CDPMessageBus.Current.SendObjectChangeEvent(glossary, EventKind.Added); Assert.IsTrue(this.glossaryBrowser.Glossaries.Count == 1); // Verify that the same glossary doesn't get added several times CDPMessageBus.Current.SendObjectChangeEvent(glossary, EventKind.Added); Assert.IsTrue(this.glossaryBrowser.Glossaries.Count == 1); // Verify that when a RDL is changed all its glossaries get added to the GlossaryBrowser var glossary2 = new Glossary(Guid.NewGuid(), this.assembler.Cache, this.uri) { Name = "Another test glossary", ShortName = "TG2" }; var rdl = new ModelReferenceDataLibrary(Guid.NewGuid(), this.assembler.Cache, this.uri); rdl.Glossary.Add(glossary2); CDPMessageBus.Current.SendObjectChangeEvent(glossary2, EventKind.Added); Assert.IsTrue(this.glossaryBrowser.Glossaries.Count == 2); }
/// <summary> /// Serialize the <see cref="ModelReferenceDataLibrary"/> /// </summary> /// <param name="modelReferenceDataLibrary">The <see cref="ModelReferenceDataLibrary"/> to serialize</param> /// <returns>The <see cref="JObject"/></returns> private JObject Serialize(ModelReferenceDataLibrary modelReferenceDataLibrary) { var jsonObject = new JObject(); jsonObject.Add("alias", this.PropertySerializerMap["alias"](modelReferenceDataLibrary.Alias.OrderBy(x => x, this.guidComparer))); jsonObject.Add("baseQuantityKind", this.PropertySerializerMap["baseQuantityKind"](modelReferenceDataLibrary.BaseQuantityKind.OrderBy(x => x, this.orderedItemComparer))); jsonObject.Add("baseUnit", this.PropertySerializerMap["baseUnit"](modelReferenceDataLibrary.BaseUnit.OrderBy(x => x, this.guidComparer))); jsonObject.Add("classKind", this.PropertySerializerMap["classKind"](Enum.GetName(typeof(CDP4Common.CommonData.ClassKind), modelReferenceDataLibrary.ClassKind))); jsonObject.Add("constant", this.PropertySerializerMap["constant"](modelReferenceDataLibrary.Constant.OrderBy(x => x, this.guidComparer))); jsonObject.Add("definedCategory", this.PropertySerializerMap["definedCategory"](modelReferenceDataLibrary.DefinedCategory.OrderBy(x => x, this.guidComparer))); jsonObject.Add("definition", this.PropertySerializerMap["definition"](modelReferenceDataLibrary.Definition.OrderBy(x => x, this.guidComparer))); jsonObject.Add("excludedDomain", this.PropertySerializerMap["excludedDomain"](modelReferenceDataLibrary.ExcludedDomain.OrderBy(x => x, this.guidComparer))); jsonObject.Add("excludedPerson", this.PropertySerializerMap["excludedPerson"](modelReferenceDataLibrary.ExcludedPerson.OrderBy(x => x, this.guidComparer))); jsonObject.Add("fileType", this.PropertySerializerMap["fileType"](modelReferenceDataLibrary.FileType.OrderBy(x => x, this.guidComparer))); jsonObject.Add("glossary", this.PropertySerializerMap["glossary"](modelReferenceDataLibrary.Glossary.OrderBy(x => x, this.guidComparer))); jsonObject.Add("hyperLink", this.PropertySerializerMap["hyperLink"](modelReferenceDataLibrary.HyperLink.OrderBy(x => x, this.guidComparer))); jsonObject.Add("iid", this.PropertySerializerMap["iid"](modelReferenceDataLibrary.Iid)); jsonObject.Add("modifiedOn", this.PropertySerializerMap["modifiedOn"](modelReferenceDataLibrary.ModifiedOn)); jsonObject.Add("name", this.PropertySerializerMap["name"](modelReferenceDataLibrary.Name)); jsonObject.Add("parameterType", this.PropertySerializerMap["parameterType"](modelReferenceDataLibrary.ParameterType.OrderBy(x => x, this.guidComparer))); jsonObject.Add("referenceSource", this.PropertySerializerMap["referenceSource"](modelReferenceDataLibrary.ReferenceSource.OrderBy(x => x, this.guidComparer))); jsonObject.Add("requiredRdl", this.PropertySerializerMap["requiredRdl"](modelReferenceDataLibrary.RequiredRdl)); jsonObject.Add("revisionNumber", this.PropertySerializerMap["revisionNumber"](modelReferenceDataLibrary.RevisionNumber)); jsonObject.Add("rule", this.PropertySerializerMap["rule"](modelReferenceDataLibrary.Rule.OrderBy(x => x, this.guidComparer))); jsonObject.Add("scale", this.PropertySerializerMap["scale"](modelReferenceDataLibrary.Scale.OrderBy(x => x, this.guidComparer))); jsonObject.Add("shortName", this.PropertySerializerMap["shortName"](modelReferenceDataLibrary.ShortName)); jsonObject.Add("thingPreference", this.PropertySerializerMap["thingPreference"](modelReferenceDataLibrary.ThingPreference)); jsonObject.Add("unit", this.PropertySerializerMap["unit"](modelReferenceDataLibrary.Unit.OrderBy(x => x, this.guidComparer))); jsonObject.Add("unitPrefix", this.PropertySerializerMap["unitPrefix"](modelReferenceDataLibrary.UnitPrefix.OrderBy(x => x, this.guidComparer))); return(jsonObject); }
public void VerifyThatUnitPrefixFromExistingRdlsAreLoaded() { var siterefenceDataLibrary = new SiteReferenceDataLibrary(Guid.NewGuid(), null, null); var unitPrefix1 = new UnitPrefix(Guid.NewGuid(), null, null); var unitPrefix2 = new UnitPrefix(Guid.NewGuid(), null, null); siterefenceDataLibrary.UnitPrefix.Add(unitPrefix1); siterefenceDataLibrary.UnitPrefix.Add(unitPrefix2); this.siteDirectory.SiteReferenceDataLibrary.Add(siterefenceDataLibrary); var engineeringModelSetup = new EngineeringModelSetup(Guid.NewGuid(), null, null); var modelReferenceDataLibrary = new ModelReferenceDataLibrary(Guid.NewGuid(), null, null); var unitPrefix3 = new UnitPrefix(Guid.NewGuid(), null, null); var unitPrefix4 = new UnitPrefix(Guid.NewGuid(), null, null); modelReferenceDataLibrary.UnitPrefix.Add(unitPrefix3); modelReferenceDataLibrary.UnitPrefix.Add(unitPrefix4); engineeringModelSetup.RequiredRdl.Add(modelReferenceDataLibrary); this.siteDirectory.Model.Add(engineeringModelSetup); this.openRdlList = new List <ReferenceDataLibrary>(this.siteDirectory.SiteReferenceDataLibrary) { modelReferenceDataLibrary }; this.session.Setup(x => x.OpenReferenceDataLibraries).Returns(new HashSet <ReferenceDataLibrary>(this.openRdlList)); var browser = new UnitPrefixBrowserViewModel(this.session.Object, this.siteDirectory, null, null, null, null); Assert.AreEqual(4, browser.UnitPrefixes.Count); }
/// <summary> /// Initializes the properties of this <see cref="Requirement"/> /// </summary> protected override void Initialize() { base.Initialize(); var iteration = (Iteration)this.Container ?? this.ChainOfContainer.OfType <Iteration>().Single(); var model = (EngineeringModel)iteration.Container; this.mRdl = model.EngineeringModelSetup.RequiredRdl.Single(); }
/// <summary> /// Close a <see cref="ModelReferenceDataLibrary"/> /// </summary> /// <param name="modelRdl"> /// The model RDL. /// </param> /// <returns> /// The <see cref="Task"/>. /// </returns> public async Task CloseModelRdl(ModelReferenceDataLibrary modelRdl) { CDPMessageBus.Current.SendMessage(new SessionEvent(this, SessionStatus.BeginUpdate)); await this.Assembler.CloseRdl(modelRdl); CDPMessageBus.Current.SendMessage(new SessionEvent(this, SessionStatus.EndUpdate)); this.openReferenceDataLibraries.Remove(modelRdl); CDPMessageBus.Current.SendMessage(new SessionEvent(this, SessionStatus.RdlClosed)); }
public void Setup() { RxApp.MainThreadScheduler = Scheduler.CurrentThread; this.session = new Mock <ISession>(); this.uri = new Uri("http://www.rheagroup.com"); this.assembler = new Assembler(this.uri); this.permissionService = new Mock <IPermissionService>(); this.thingDialogNavigationService = new Mock <IThingDialogNavigationService>(); this.dialogNavigationService = new Mock <IDialogNavigationService>(); this.session.Setup(x => x.PermissionService).Returns(this.permissionService.Object); this.thingCreator = new Mock <IThingCreator>(); var siteDirectory = new SiteDirectory(); var engineeringModelSetup = new EngineeringModelSetup(Guid.NewGuid(), this.assembler.Cache, this.uri); var iterationsetup = new IterationSetup(); var engineeringModel = new EngineeringModel(Guid.NewGuid(), this.assembler.Cache, this.uri) { EngineeringModelSetup = engineeringModelSetup }; engineeringModelSetup.IterationSetup.Add(iterationsetup); var siteReferenceDataLibrary = new SiteReferenceDataLibrary(Guid.NewGuid(), this.assembler.Cache, this.uri); siteDirectory.SiteReferenceDataLibrary.Add(siteReferenceDataLibrary); this.modelReferenceDataLibrary = new ModelReferenceDataLibrary(Guid.NewGuid(), this.assembler.Cache, this.uri) { RequiredRdl = siteReferenceDataLibrary }; engineeringModelSetup.RequiredRdl.Add(this.modelReferenceDataLibrary); var person = new Person(Guid.NewGuid(), this.assembler.Cache, this.uri) { GivenName = "test", Surname = "test" }; var participant = new Participant(Guid.NewGuid(), this.assembler.Cache, this.uri) { Person = person }; engineeringModelSetup.Participant.Add(participant); this.session.Setup(x => x.ActivePerson).Returns(person); this.iteration = new Iteration(Guid.NewGuid(), null, this.uri) { IterationSetup = iterationsetup }; engineeringModel.Iteration.Add(this.iteration); siteDirectory.Model.Add(engineeringModelSetup); 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 Tuple <DomainOfExpertise, Participant>(null, participant) } }); }
public void SetUp() { this.revision = typeof(Thing).GetProperty("RevisionNumber"); this.thingCreator = new Mock <IThingCreator>(); 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.sitedir = new SiteDirectory(Guid.NewGuid(), this.cache, this.uri); this.siteReferenceDataLibrary = new SiteReferenceDataLibrary(Guid.NewGuid(), this.cache, this.uri); this.sitedir.SiteReferenceDataLibrary.Add(this.siteReferenceDataLibrary); this.modelReferenceDataLibrary = new ModelReferenceDataLibrary(Guid.NewGuid(), this.cache, this.uri); this.modelsetup = new EngineeringModelSetup(Guid.NewGuid(), this.cache, this.uri) { Name = "model" }; this.modelsetup.RequiredRdl.Add(this.modelReferenceDataLibrary); this.modelReferenceDataLibrary.RequiredRdl = this.siteReferenceDataLibrary; 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 SetUp() { this.ribbonManager = new Mock <IFluentRibbonManager>(); this.panelNavigationService = new Mock <IPanelNavigationService>(); this.thingDialogNavigationService = new Mock <IThingDialogNavigationService>(); this.dialogNavigationService = new Mock <IDialogNavigationService>(); this.pluginSettingsService = new Mock <IPluginSettingsService>(); this.cache = new ConcurrentDictionary <CacheKey, Lazy <Thing> >(); this.siteDirectory = new SiteDirectory(Guid.NewGuid(), this.cache, this.uri); this.engineeringModelSetup = new EngineeringModelSetup(Guid.NewGuid(), this.cache, this.uri) { ShortName = "TST", Name = "Test" }; this.iterationSetup = new IterationSetup(Guid.NewGuid(), this.cache, this.uri) { IterationNumber = 1, Description = "iteraiton 1" }; this.engineeringModelSetup.IterationSetup.Add(this.iterationSetup); this.siteDirectory.Model.Add(this.engineeringModelSetup); this.person = new Person(Guid.NewGuid(), this.cache, this.uri) { GivenName = "John", Surname = "Doe" }; 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.engineeringModel = new EngineeringModel(Guid.NewGuid(), this.cache, this.uri) { EngineeringModelSetup = this.engineeringModelSetup }; this.iteration = new Iteration(Guid.NewGuid(), this.cache, this.uri) { IterationSetup = this.iterationSetup }; this.engineeringModel.Iteration.Add(this.iteration); this.modelReferenceDataLibrary = new ModelReferenceDataLibrary(Guid.NewGuid(), this.cache, this.uri); this.siteReferenceDataLibrary = new SiteReferenceDataLibrary(Guid.NewGuid(), this.cache, this.uri); this.engineeringModelSetup.RequiredRdl.Add(this.modelReferenceDataLibrary); this.modelReferenceDataLibrary.RequiredRdl = this.siteReferenceDataLibrary; this.siteDirectory.SiteReferenceDataLibrary.Add(this.siteReferenceDataLibrary); this.session = new Mock <ISession>(); this.permissionService = new Mock <IPermissionService>(); this.session.Setup(x => x.RetrieveSiteDirectory()).Returns(this.siteDirectory); this.session.Setup(x => x.ActivePerson).Returns(this.person); this.session.Setup(x => x.PermissionService).Returns(this.permissionService.Object); this.session.Setup(x => x.QuerySelectedDomainOfExpertise(this.iteration)).Returns(this.domain); }
public void SetUp() { this.mRdl = new ModelReferenceDataLibrary(); this.sRdl1 = new SiteReferenceDataLibrary(); this.sRdl11 = new SiteReferenceDataLibrary(); this.sRdl2 = new SiteReferenceDataLibrary(); this.mRdl.RequiredRdl = this.sRdl11; this.sRdl11.RequiredRdl = this.sRdl1; }
public void SetUp() { this.binaryRelationshipRuleRuleChecker = new BinaryRelationshipRuleRuleChecker(); this.modelReferenceDataLibrary = new ModelReferenceDataLibrary(); this.binaryRelationshipRule = new BinaryRelationshipRule { Iid = Guid.Parse("426f4e96-dcfd-4589-bce0-856bea40495b"), ShortName = "BINRULE" }; this.modelReferenceDataLibrary.Rule.Add(this.binaryRelationshipRule); }
public void Setup() { this.session = new Mock <ISession>(); this.permissionService = new Mock <IPermissionService>(); this.thingDialogNavigationService = new Mock <IThingDialogNavigationService>(); this.session.Setup(x => x.PermissionService).Returns(this.permissionService.Object); this.cache = new ConcurrentDictionary <CacheKey, Lazy <Thing> >(); this.sitedir = new SiteDirectory(Guid.NewGuid(), this.cache, this.uri); this.srdl = new SiteReferenceDataLibrary(Guid.NewGuid(), this.cache, this.uri); this.mrdl = new ModelReferenceDataLibrary(Guid.NewGuid(), this.cache, this.uri) { RequiredRdl = this.srdl }; this.modelsetup = new EngineeringModelSetup(Guid.NewGuid(), this.cache, this.uri); this.sitedir.Model.Add(this.modelsetup); this.modelsetup.RequiredRdl.Add(this.mrdl); this.model = new EngineeringModel(Guid.NewGuid(), this.cache, this.uri) { EngineeringModelSetup = this.modelsetup }; this.iteration = new Iteration(Guid.NewGuid(), this.cache, this.uri); this.model.Iteration.Add(this.iteration); this.alphaOwner = new DomainOfExpertise(Guid.NewGuid(), this.cache, this.uri) { Name = "Alpha Owner" }; this.betaOwner = new DomainOfExpertise(Guid.NewGuid(), this.cache, this.uri) { Name = "Beta Owner" }; this.gammaOwner = new DomainOfExpertise(Guid.NewGuid(), this.cache, this.uri) { Name = "Gamma Owner" }; this.possibleOwners = new List <DomainOfExpertise> { this.gammaOwner, this.alphaOwner, this.betaOwner }; this.sitedir.Domain.AddRange(this.possibleOwners); this.modelsetup.ActiveDomain.AddRange(this.possibleOwners); this.cat = new Category(); this.cat.PermissibleClass.Add(ClassKind.PossibleFiniteStateList); this.srdl.DefinedCategory.Add(this.cat); this.cache.TryAdd(new CacheKey(this.iteration.Iid, null), new Lazy <Thing>(() => this.iteration)); this.session.Setup(x => x.RetrieveSiteDirectory()).Returns(this.sitedir); 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 Setup() { this.session = new Mock <ISession>(); this.thingDialogNavigationService = new Mock <IThingDialogNavigationService>(); this.cache = new ConcurrentDictionary <CacheKey, Lazy <Thing> >(); var dal = new Mock <IDal>(); dal.Setup(x => x.MetaDataProvider).Returns(new MetaDataProvider()); this.session.Setup(x => x.DalVersion).Returns(new Version(1, 1, 0)); this.session.Setup(x => x.Dal).Returns(dal.Object); this.siteDir = new SiteDirectory(Guid.NewGuid(), this.cache, this.uri); this.modelsetup = new EngineeringModelSetup(Guid.NewGuid(), this.cache, this.uri); this.iterationsetup = new IterationSetup(Guid.NewGuid(), this.cache, this.uri); this.srdl = new SiteReferenceDataLibrary(Guid.NewGuid(), this.cache, this.uri); this.mrdl = new ModelReferenceDataLibrary(Guid.NewGuid(), this.cache, this.uri) { RequiredRdl = this.srdl }; this.siteDir.Model.Add(this.modelsetup); this.modelsetup.IterationSetup.Add(this.iterationsetup); this.siteDir.SiteReferenceDataLibrary.Add(this.srdl); this.modelsetup.RequiredRdl.Add(this.mrdl); 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.requirement = new Requirement(Guid.NewGuid(), this.cache, this.uri); this.relationalExpression = new RelationalExpression(Guid.NewGuid(), this.cache, this.uri); this.parametricConstraint = new ParametricConstraint(Guid.NewGuid(), this.cache, this.uri); this.requirement.ParametricConstraint.Add(this.parametricConstraint); this.parametricConstraint.Expression.Add(this.relationalExpression); this.reqSpec = new RequirementsSpecification(Guid.NewGuid(), this.cache, this.uri); this.reqSpec.Requirement.Add(this.requirement); this.grp = new RequirementsGroup(Guid.NewGuid(), this.cache, this.uri); this.reqSpec.Group.Add(this.grp); this.cache.TryAdd(new CacheKey(this.reqSpec.Iid, null), new Lazy <Thing>(() => this.reqSpec)); this.model.Iteration.Add(this.iteration); this.iteration.RequirementsSpecification.Add(this.reqSpec); this.clone = this.parametricConstraint.Clone(false); var transactionContext = TransactionContextResolver.ResolveContext(this.iteration); this.thingTransaction = new ThingTransaction(transactionContext, this.clone); this.dateRelationalExpression = new RelationalExpression(Guid.NewGuid(), this.cache, this.uri); this.dateRelationalExpression.ParameterType = new DateParameterType(); this.dateRelationalExpression.Value = new ValueArray <string>(new[] { "2019-12-31" }); }
/// <summary> /// Initializes the properties of this <see cref="Requirement"/> /// </summary> protected override void Initialize() { base.Initialize(); var iteration = (Iteration)this.Container.Container ?? this.ChainOfContainer.OfType <Iteration>().Single(); var model = (EngineeringModel)iteration.Container; this.mRdl = model.EngineeringModelSetup.RequiredRdl.Single(); this.SimpleParameterValue = new ReactiveList <SimpleParameterValueRowViewModel>(); this.ParametricConstraintExpression = new ReactiveList <IRowViewModelBase <BooleanExpression> >(); this.PossibleLanguageCode = new ReactiveList <LanguageCodeUsage>(); this.PopulateSimpleParameterValues(); this.PopulateParametricConstraint(); }
public void TearDown() { CDPMessageBus.Current.ClearSubscriptions(); this.credentials = null; this.dal = null; this.session = null; this.siteDirectory = null; this.siteReferenceDataLibrary = null; this.modelReferenceDataLibrary = null; this.iterationSetup = null; this.engineeringModelSetup = null; this.engineeringModel = null; }
public void SetUp() { this.referenceDataLibraryRuleChecker = new ReferenceDataLibraryRuleChecker(); this.modelReferenceDataLibrary = new ModelReferenceDataLibrary(); this.siteReferenceDataLibrary = new SiteReferenceDataLibrary { Iid = Guid.Parse("9de8bb06-e696-42a4-9cb5-ac9ca2f1ff43"), ShortName = "GENERIC" }; this.modelReferenceDataLibrary.RequiredRdl = this.siteReferenceDataLibrary; }
private void SetupData() { this.sessionService = new Mock <ISessionService>(); 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) { ShortName = "TEST", 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.Assembler.Cache.TryAdd(new CacheKey(this.model.Iid, null), new Lazy <Thing>(() => this.model)); this.Assembler.Cache.TryAdd(new CacheKey(this.siteReferenceDataLibrary.Iid, null), new Lazy <Thing>(() => this.siteReferenceDataLibrary)); this.sessionService.Setup(x => x.Iteration).Returns(this.Iteration); this.reportGenerator = new ReportGenerator(this.sessionService.Object); }
public void SetUp() { this.cache = new ConcurrentDictionary <CacheKey, Lazy <Thing> >(); this.iteration = new Iteration(Guid.NewGuid(), this.cache, null); var engineeringModel = new EngineeringModel(Guid.NewGuid(), this.cache, null); var modelReferenceDataLibrary = new ModelReferenceDataLibrary(Guid.NewGuid(), this.cache, null); engineeringModel.EngineeringModelSetup = new EngineeringModelSetup(Guid.NewGuid(), this.cache, null); engineeringModel.EngineeringModelSetup.RequiredRdl.Add(modelReferenceDataLibrary); this.iteration.Container = engineeringModel; this.cat1 = new Category(Guid.NewGuid(), this.cache, null) { ShortName = "cat1", Name = "cat1" }; modelReferenceDataLibrary.DefinedCategory.Add(this.cat1); this.cache.TryAdd(new CacheKey(this.cat1.Iid, null), new Lazy <Thing>(() => this.cat1)); this.cat2 = new Category(Guid.NewGuid(), this.cache, null) { ShortName = "cat2", Name = "cat2" }; modelReferenceDataLibrary.DefinedCategory.Add(this.cat2); this.cache.TryAdd(new CacheKey(this.cat2.Iid, null), new Lazy <Thing>(() => this.cat2)); this.cat3 = new Category(Guid.NewGuid(), this.cache, null) { ShortName = "cat3", Name = "cat3" }; modelReferenceDataLibrary.DefinedCategory.Add(this.cat3); this.cache.TryAdd(new CacheKey(this.cat3.Iid, null), new Lazy <Thing>(() => this.cat3)); this.cat4 = new Category(Guid.NewGuid(), this.cache, null) { ShortName = "cat4", Name = "cat4" }; modelReferenceDataLibrary.DefinedCategory.Add(this.cat4); this.cache.TryAdd(new CacheKey(this.cat4.Iid, null), new Lazy <Thing>(() => this.cat4)); }
public void SetUp() { RxApp.MainThreadScheduler = Scheduler.CurrentThread; this.thingDialogNavigationService = new Mock <IThingDialogNavigationService>(); this.session = new Mock <ISession>(); this.uri = new Uri("http://www.rheagroup.com"); this.assembler = new Assembler(this.uri); this.cache = this.assembler.Cache; this.siteDir = new SiteDirectory(Guid.NewGuid(), this.cache, this.uri); this.person = new Person(Guid.NewGuid(), this.cache, this.uri) { ShortName = "test" }; this.rdl1 = new SiteReferenceDataLibrary(Guid.NewGuid(), this.cache, this.uri) { Name = "rdl1", ShortName = "1" }; this.rdl2 = new SiteReferenceDataLibrary(Guid.NewGuid(), this.cache, this.uri) { Name = "rdl2", ShortName = "2" }; this.rdl21 = new SiteReferenceDataLibrary(Guid.NewGuid(), this.cache, this.uri) { Name = "rdl21", ShortName = "21", RequiredRdl = this.rdl2 }; this.mrdl = new ModelReferenceDataLibrary(Guid.NewGuid(), this.cache, this.uri) { Name = "Model RDL", ShortName = "mrdl", RequiredRdl = this.rdl21 }; this.siteDir.SiteReferenceDataLibrary.Add(this.rdl1); this.siteDir.SiteReferenceDataLibrary.Add(this.rdl2); this.siteDir.SiteReferenceDataLibrary.Add(this.rdl21); this.session.Setup(x => x.DataSourceUri).Returns(this.uri.ToString()); this.session.Setup(x => x.RetrieveSiteDirectory()).Returns(this.siteDir); this.session.Setup(x => x.ActivePerson).Returns(this.person); 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); this.session.Setup(x => x.PermissionService).Returns(this.permissionService.Object); }
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); }