Skip to content

Commit 50aee09

Browse files
author
samatrhea
committed
[Refactor] SysML2.NET.Serializer.Dictionary namespaces
1 parent a539ca8 commit 50aee09

File tree

338 files changed

+569
-545
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

338 files changed

+569
-545
lines changed

SysML2.NET.CodeGenerator/Templates/core-dictionary-dto-serializer-reader-provider-template.hbs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
2323
// ------------------------------------------------------------------------------------------------
2424

25-
namespace SysML2.NET.Serializer.Dictionary
25+
namespace SysML2.NET.Serializer.Dictionary.Core.DTO
2626
{
2727
using System;
2828
using System.Collections.Generic;
@@ -64,6 +64,18 @@ namespace SysML2.NET.Serializer.Dictionary
6464

6565
return func;
6666
}
67+
68+
/// <summary>
69+
/// Asserts whether the <paramref name="typeName"/> is supported by the provider
70+
/// </summary>
71+
/// <param name="typeName">
72+
/// The name of the subject <see cref="System.Type"/> for which support is asserted
73+
/// </param>
74+
/// <returns></returns>
75+
internal static bool IsTypeSupported(string typeName)
76+
{
77+
return DictionaryReaderFuncMap.ContainsKey(typeName);
78+
}
6779
}
6880
}
6981

SysML2.NET.CodeGenerator/Templates/core-dictionary-dto-serializer-reader-template.hbs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
2323
// ------------------------------------------------------------------------------------------------
2424

25-
namespace SysML2.NET.Serializer.Dictionary
25+
namespace SysML2.NET.Serializer.Dictionary.Core.DTO
2626
{
2727
using System;
2828
using System.Collections.Generic;
@@ -273,7 +273,7 @@ namespace SysML2.NET.Serializer.Dictionary
273273
{{/if}}
274274
{{ else }}
275275
{{String.LowerCaseFirstLetter EClass.Name}}Instance.{{ String.CapitalizeFirstLetter structuralFeature.Name }} = {{ structuralFeature.Name }}Feature;
276-
{{/if}}
276+
{{/if}}
277277
{{/unless}}
278278
{{/unless}}
279279
{{/each}}
@@ -324,7 +324,7 @@ namespace SysML2.NET.Serializer.Dictionary
324324
}
325325
var id = Guid.Parse(Convert.ToString(idObject));
326326

327-
var {{String.LowerCaseFirstLetter this.Name}}Instance = new Core.DTO.{{this.Name}}
327+
var {{String.LowerCaseFirstLetter this.Name}}Instance = new SysML2.NET.Core.DTO.{{this.Name}}
328328
{
329329
Id = id
330330
};

SysML2.NET.CodeGenerator/Templates/core-dictionary-dto-serializer-writer-provider-template.hbs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
2323
// ------------------------------------------------------------------------------------------------
2424

25-
namespace SysML2.NET.Serializer.Dictionary
25+
namespace SysML2.NET.Serializer.Dictionary.Core.DTO
2626
{
2727
using System;
2828
using System.Collections.Generic;
@@ -64,6 +64,18 @@ namespace SysML2.NET.Serializer.Dictionary
6464

6565
return func;
6666
}
67+
68+
/// <summary>
69+
/// Asserts whether the <paramref name="type"/> is supported by the provider
70+
/// </summary>
71+
/// <param name="typeName">
72+
/// The name of the subject <see cref="System.Type"/> for which support is asserted
73+
/// </param>
74+
/// <returns></returns>
75+
internal static bool IsTypeSupported(System.Type type)
76+
{
77+
return DictionaryWriterFuncMap.ContainsKey(type);
78+
}
6779
}
6880
}
6981

SysML2.NET.CodeGenerator/Templates/core-dictionary-dto-serializer-writer-template.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
2323
// ------------------------------------------------------------------------------------------------
2424

25-
namespace SysML2.NET.Serializer.Dictionary
25+
namespace SysML2.NET.Serializer.Dictionary.Core.DTO
2626
{
2727
using System;
2828
using System.Collections.Generic;

SysML2.NET.Serializer.Dictionary.Tests/ReaderTestFixture.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ public void Verify_that_when_dictionary_is_read_instance_of_IAnnotatingElement_i
5656
{ "@id", Guid.Parse("0b192c18-afa2-44b6-8de2-86e5e6ffa09e") },
5757
{ "aliasIds", new List<string> { "alias_1", "alias_2" } },
5858
{ "annotation", new List<Guid> { Guid.Parse("7f8c06c6-93cb-4193-9a0c-c6ca4dc1eec1") } },
59-
{ "declaredName", "the name" },
60-
{ "declaredShortName", "the shortName" },
61-
{ "elementId", "element id" },
59+
{ "declaredName", "the name" },
60+
{ "declaredShortName", "the shortName" },
61+
{ "elementId", "element id" },
6262
{ "isImpliedIncluded", true },
6363
{ "ownedRelationship", new List<Guid> { Guid.Parse("9006ff06-43fe-4a4e-a4bc-402e82f84dde") } },
6464
{ "owningRelationship", Guid.Parse("fe6d7f0c-6e7b-4ce9-acbe-25d2537f08d9") }
@@ -68,9 +68,9 @@ public void Verify_that_when_dictionary_is_read_instance_of_IAnnotatingElement_i
6868

6969
Assert.That(annotatingElement.Id, Is.EqualTo(Guid.Parse("0b192c18-afa2-44b6-8de2-86e5e6ffa09e")));
7070
Assert.That(annotatingElement.AliasIds, Is.EqualTo(new List<string> { "alias_1", "alias_2" }));
71-
Assert.That(annotatingElement.DeclaredName, Is.EqualTo("the name"));
72-
Assert.That(annotatingElement.DeclaredShortName, Is.EqualTo("the shortName"));
73-
Assert.That(annotatingElement.ElementId, Is.EqualTo("element id"));
71+
Assert.That(annotatingElement.DeclaredName, Is.EqualTo("the name"));
72+
Assert.That(annotatingElement.DeclaredShortName, Is.EqualTo("the shortName"));
73+
Assert.That(annotatingElement.ElementId, Is.EqualTo("element id"));
7474
Assert.That(annotatingElement.IsImpliedIncluded, Is.True);
7575
Assert.That(annotatingElement.OwnedRelationship, Is.EqualTo(new List<Guid> { Guid.Parse("9006ff06-43fe-4a4e-a4bc-402e82f84dde") }));
7676
Assert.That(annotatingElement.OwningRelationship, Is.EqualTo(Guid.Parse("fe6d7f0c-6e7b-4ce9-acbe-25d2537f08d9")));
@@ -85,7 +85,7 @@ public void Verify_that_when_dictionary_is_read_instance_of_IAnnotatingElement_i
8585
{ "annotation", new List<Guid>() },
8686
{ "declaredName", null },
8787
{ "declaredShortName", null },
88-
{ "elementId", "element id" },
88+
{ "elementId", "element id" },
8989
{ "isImpliedIncluded", true },
9090
{ "ownedRelationship", new List<Guid>() },
9191
{ "owningRelationship", null }
@@ -95,9 +95,9 @@ public void Verify_that_when_dictionary_is_read_instance_of_IAnnotatingElement_i
9595

9696
Assert.That(annotatingElement.Id, Is.EqualTo(Guid.Parse("0b192c18-afa2-44b6-8de2-86e5e6ffa09e")));
9797
Assert.That(annotatingElement.AliasIds, Is.EqualTo(new List<string>()));
98-
Assert.That(annotatingElement.DeclaredName, Is.Null);
99-
Assert.That(annotatingElement.DeclaredShortName, Is.Null);
100-
Assert.That(annotatingElement.ElementId, Is.EqualTo("element id"));
98+
Assert.That(annotatingElement.DeclaredName, Is.Null);
99+
Assert.That(annotatingElement.DeclaredShortName, Is.Null);
100+
Assert.That(annotatingElement.ElementId, Is.EqualTo("element id"));
101101
Assert.That(annotatingElement.IsImpliedIncluded, Is.True);
102102
Assert.That(annotatingElement.OwnedRelationship, Is.EqualTo(new List<Guid>()));
103103
Assert.That(annotatingElement.OwningRelationship, Is.Null);
@@ -110,9 +110,9 @@ public void Verify_that_when_dictionary_is_read_instance_of_IAnnotatingElement_i
110110
{ "@id", "0b192c18-afa2-44b6-8de2-86e5e6ffa09e" },
111111
{ "aliasIds", new List<string> { "alias_1", "alias_2" } },
112112
{ "annotation", new List<string> { "7f8c06c6-93cb-4193-9a0c-c6ca4dc1eec1" } },
113-
{ "declaredName", "the name" },
114-
{ "declaredShortName", "the shortName" },
115-
{ "elementId", "element id" },
113+
{ "declaredName", "the name" },
114+
{ "declaredShortName", "the shortName" },
115+
{ "elementId", "element id" },
116116
{ "isImpliedIncluded", true },
117117
{ "ownedRelationship", new List<string> { "9006ff06-43fe-4a4e-a4bc-402e82f84dde" } },
118118
{ "owningRelationship", "fe6d7f0c-6e7b-4ce9-acbe-25d2537f08d9" }

SysML2.NET.Serializer.Dictionary.Tests/WriterTestFixture.cs

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -42,48 +42,48 @@ public class WriterTestFixture
4242

4343
private PartDefinition partDefinitionWithNullProperties;
4444

45-
[SetUp]
45+
[SetUp]
4646
public void SetUp()
4747
{
4848
this.writer = new Writer();
4949

5050
this.CreateTestData();
51-
}
51+
}
5252

5353
private void CreateTestData()
5454
{
55-
this.partDefinition = new PartDefinition
56-
{
57-
Id = Guid.NewGuid(),
58-
IsIndividual = true,
59-
IsVariation = false,
60-
IsAbstract = false,
61-
IsSufficient = false,
62-
AliasIds = new List<string> { "PartDefinition:Alias_1", "PartDefinition:Alias_2" },
63-
DeclaredName = "PartDefinition:DeclaredName",
55+
this.partDefinition = new PartDefinition
56+
{
57+
Id = Guid.NewGuid(),
58+
IsIndividual = true,
59+
IsVariation = false,
60+
IsAbstract = false,
61+
IsSufficient = false,
62+
AliasIds = new List<string> { "PartDefinition:Alias_1", "PartDefinition:Alias_2" },
63+
DeclaredName = "PartDefinition:DeclaredName",
6464
ElementId = "PartDefinition:ElementId",
6565
OwnedRelationship = new List<Guid> { Guid.NewGuid() },
66-
OwningRelationship = Guid.NewGuid(),
67-
DeclaredShortName = "PartDefinition:DeclaredShortName"
68-
};
69-
70-
this.partDefinitionWithNullProperties = new PartDefinition
71-
{
72-
Id = Guid.NewGuid(),
73-
IsIndividual = true,
74-
IsVariation = false,
75-
IsAbstract = false,
76-
IsSufficient = false,
77-
AliasIds = new List<string>(),
78-
DeclaredName = null,
79-
ElementId = "PartDefinition:ElementId",
80-
OwnedRelationship = new List<Guid>(),
81-
OwningRelationship = Guid.NewGuid(),
82-
DeclaredShortName = null
83-
};
66+
OwningRelationship = Guid.NewGuid(),
67+
DeclaredShortName = "PartDefinition:DeclaredShortName"
68+
};
69+
70+
this.partDefinitionWithNullProperties = new PartDefinition
71+
{
72+
Id = Guid.NewGuid(),
73+
IsIndividual = true,
74+
IsVariation = false,
75+
IsAbstract = false,
76+
IsSufficient = false,
77+
AliasIds = new List<string>(),
78+
DeclaredName = null,
79+
ElementId = "PartDefinition:ElementId",
80+
OwnedRelationship = new List<Guid>(),
81+
OwningRelationship = Guid.NewGuid(),
82+
DeclaredShortName = null
83+
};
8484
}
8585

86-
[Test]
86+
[Test]
8787
public void Verify_that_the_writer_returns_a_dictionary_upon_write_Simplified_single_dataItem()
8888
{
8989
var dictionary = this.writer.Write(this.partDefinition, DictionaryKind.Simplified);

SysML2.NET.Serializer.Dictionary/Core/AutoGenDictionaryReader/AcceptActionUsageDictionaryReader.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
2323
// ------------------------------------------------------------------------------------------------
2424

25-
namespace SysML2.NET.Serializer.Dictionary
25+
namespace SysML2.NET.Serializer.Dictionary.Core.DTO
2626
{
2727
using System;
2828
using System.Collections.Generic;
@@ -450,7 +450,7 @@ private static IAcceptActionUsage DictionaryNullAndTypeCheck(Dictionary<string,
450450
}
451451
var id = Guid.Parse(Convert.ToString(idObject));
452452

453-
var acceptActionUsageInstance = new Core.DTO.AcceptActionUsage
453+
var acceptActionUsageInstance = new SysML2.NET.Core.DTO.AcceptActionUsage
454454
{
455455
Id = id
456456
};

SysML2.NET.Serializer.Dictionary/Core/AutoGenDictionaryReader/ActionDefinitionDictionaryReader.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
2323
// ------------------------------------------------------------------------------------------------
2424

25-
namespace SysML2.NET.Serializer.Dictionary
25+
namespace SysML2.NET.Serializer.Dictionary.Core.DTO
2626
{
2727
using System;
2828
using System.Collections.Generic;
@@ -324,7 +324,7 @@ private static IActionDefinition DictionaryNullAndTypeCheck(Dictionary<string, o
324324
}
325325
var id = Guid.Parse(Convert.ToString(idObject));
326326

327-
var actionDefinitionInstance = new Core.DTO.ActionDefinition
327+
var actionDefinitionInstance = new SysML2.NET.Core.DTO.ActionDefinition
328328
{
329329
Id = id
330330
};

SysML2.NET.Serializer.Dictionary/Core/AutoGenDictionaryReader/ActionUsageDictionaryReader.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
2323
// ------------------------------------------------------------------------------------------------
2424

25-
namespace SysML2.NET.Serializer.Dictionary
25+
namespace SysML2.NET.Serializer.Dictionary.Core.DTO
2626
{
2727
using System;
2828
using System.Collections.Generic;
@@ -450,7 +450,7 @@ private static IActionUsage DictionaryNullAndTypeCheck(Dictionary<string, object
450450
}
451451
var id = Guid.Parse(Convert.ToString(idObject));
452452

453-
var actionUsageInstance = new Core.DTO.ActionUsage
453+
var actionUsageInstance = new SysML2.NET.Core.DTO.ActionUsage
454454
{
455455
Id = id
456456
};

SysML2.NET.Serializer.Dictionary/Core/AutoGenDictionaryReader/ActorMembershipDictionaryReader.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
2323
// ------------------------------------------------------------------------------------------------
2424

25-
namespace SysML2.NET.Serializer.Dictionary
25+
namespace SysML2.NET.Serializer.Dictionary.Core.DTO
2626
{
2727
using System;
2828
using System.Collections.Generic;
@@ -422,7 +422,7 @@ private static IActorMembership DictionaryNullAndTypeCheck(Dictionary<string, ob
422422
}
423423
var id = Guid.Parse(Convert.ToString(idObject));
424424

425-
var actorMembershipInstance = new Core.DTO.ActorMembership
425+
var actorMembershipInstance = new SysML2.NET.Core.DTO.ActorMembership
426426
{
427427
Id = id
428428
};

0 commit comments

Comments
 (0)