public void Deserialize(string filepath) { ReqIFDeserializer deserializer = new ReqIFDeserializer(); reqif = deserializer.Deserialize(filepath).First(); header = reqif.TheHeader; content = reqif.CoreContent; embeddedObjects = reqif.EmbeddedObjects; PropertyGrid.DataContext = header; specObjectsViewModel = new SpecObjectsViewModel(content); specObjectsViewModel.SpecObjects.CollectionChanged += SpecObjects_CollectionChanged; foreach (var specObject in specObjectsViewModel.SpecObjects) { foreach (var attribute in specObject.Values) { attribute.PropertyChanged += Attribute_PropertyChanged; } foreach (var attribute in specObject.Values) { if (attribute.AttributeValue != null) { attribute.AttributeValue.PropertyChanged += AttributeValue_PropertyChanged; } } } initializeColumns(); MainDataGrid.ItemsSource = specObjectsViewModel.SpecObjects; }
public void ClearDataGrid() { content = null; header = null; embeddedObjects = null; MainDataGrid.ItemsSource = null; MainDataGrid.Columns.Clear(); MainDataGrid.Items.Refresh(); }
public void Verify_That_WriteXmlAsync_throws_exception_when_cancelled() { using var memoryStream = new MemoryStream(); using var writer = XmlWriter.Create(memoryStream, new XmlWriterSettings { Indent = true }); var reqIfHeader = new ReqIFHeader(); var cts = new CancellationTokenSource(); cts.Cancel(); Assert.That( async() => await reqIfHeader.WriteXmlAsync(writer, cts.Token), Throws.Exception.TypeOf <OperationCanceledException>()); }
public void Verify_that_ReadXmlAsync_throws_exception_when_cancelled() { var reqifPath = Path.Combine(TestContext.CurrentContext.TestDirectory, "TestData", "Datatype-Demo.reqif"); var cts = new CancellationTokenSource(); cts.Cancel(); using var fileStream = File.OpenRead(reqifPath); using var xmlReader = XmlReader.Create(fileStream, new XmlReaderSettings { Async = true }); var reqIfHeader = new ReqIFHeader(); Assert.That(async() => await reqIfHeader.ReadXmlAsync(xmlReader, cts.Token), Throws.Exception.TypeOf <OperationCanceledException>()); }
/// <summary> /// Set the header of the <see cref="ReqIF"/> object /// </summary> private void SetHeader() { var model = (EngineeringModel)this.exportedIteration.Container; var reqifHeader = new ReqIFHeader { Identifier = this.exportedIteration.Iid.ToString(), CreationTime = DateTime.UtcNow, Title = model.EngineeringModelSetup.Name + " (" + model.EngineeringModelSetup.ShortName + ")", Comment = model.EngineeringModelSetup.Definition.Any() ? model.EngineeringModelSetup.Definition.First().Content : string.Empty, ReqIFToolId = "CDP4", RepositoryId = this.currentSession.DataSourceUri, SourceToolId = "CDP4" }; this.reqIFBuilt.TheHeader.Add(reqifHeader); }
public void SetUp() { this.resultFileUri = Path.Combine(TestContext.CurrentContext.TestDirectory, "result.xml"); this.enumdatatype_id = "enumeration"; this.enum_value_low_id = "enumlow"; this.enum_value_medium_id = "enummedium"; this.specobject_1_id = "specobject_1"; this.specobject_2_id = "specobject_2"; this.specobject_3_id = "specobject_3"; this.xhtmlcontent = "<xhtml:p>XhtmlPType<xhtml:a accesskey=\"a\" charset=\"UTF-8\" href=\"http://eclipse.org/rmf\" hreflang=\"en\" rel=\"LinkTypes\" rev=\"LinkTypes\" style=\"text-decoration:underline\" tabindex=\"1\" title=\"text\" type=\"text/html\"> text before br<xhtml:br/>text after br text before span<xhtml:span>XhtmlSpanType</xhtml:span>text after span text before em<xhtml:em>XhtmlEmType</xhtml:em>text after em text before strong<xhtml:strong>XhtmlStrongType</xhtml:strong>text after strong text before dfn<xhtml:dfn>XhtmlDfnType</xhtml:dfn>text after dfn text before code<xhtml:code>XhtmlCodeType</xhtml:code>text after code text before samp<xhtml:samp>XhtmlSampType</xhtml:samp>text after samp text before kbd<xhtml:kbd>XhtmlKbdType</xhtml:kbd>text after kbd text before var<xhtml:var>XhtmlVarType</xhtml:var>text after var text before cite<xhtml:cite>XhtmlCiteType</xhtml:cite>text after cite text before abbr<xhtml:abbr>XhtmlAbbrType</xhtml:abbr>text after abbr text before acronym<xhtml:acronym>XhtmlAcronymType</xhtml:acronym>text after acronym text before q<xhtml:q>XhtmlQType</xhtml:q>text after q text before tt<xhtml:tt>XhtmlInlPresType</xhtml:tt>text after tt text before i<xhtml:i>XhtmlInlPresType</xhtml:i>text after i text before b<xhtml:b>XhtmlInlPresType</xhtml:b>text after b text before big<xhtml:big>XhtmlInlPresType</xhtml:big>text after big text before small<xhtml:small>XhtmlInlPresType</xhtml:small>text after small text before sub<xhtml:sub>XhtmlInlPresType</xhtml:sub>text after sub text before sup<xhtml:sup>XhtmlInlPresType</xhtml:sup>text after sup text before ins<xhtml:ins>XhtmlEditType</xhtml:ins>text after ins text before del<xhtml:del>XhtmlEditType</xhtml:del>text after del</xhtml:a></xhtml:p>"; this.reqIF = new ReqIF(); this.reqIF.Lang = "en"; var header = new ReqIFHeader(); header.Comment = "this is a comment"; header.CreationTime = DateTime.Parse("2015-12-01"); header.Identifier = "reqifheader"; header.RepositoryId = "a repos id"; header.ReqIFToolId = "tool - CDP4"; header.ReqIFVersion = "1.0"; header.SourceToolId = "source tool - CDP4"; header.Title = "this is a title"; this.reqIF.TheHeader.Add(header); var reqIfContent = new ReqIFContent(); this.reqIF.CoreContent.Add(reqIfContent); this.CreateDataTypes(); this.CreateSpecObjectType(); this.CreateSpecificationType(); this.CreateSpecRelationType(); this.CreateRelationGroupType(); this.CreateSpecObjects(); this.CreateSpecRelations(); this.CreateSpecifications(); this.CreateRelationGroup(); }