Skip to content

Commit a4e4e30

Browse files
1 parent 5f4a98b commit a4e4e30

15 files changed

Lines changed: 570 additions & 607 deletions

.claude/commands/implement-extensions-batch.md

Lines changed: 93 additions & 272 deletions
Large diffs are not rendered by default.

.claude/commands/implement-extensions.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,16 @@ Report to the user:
380380
knows the implementation is grounded in spec prose rather than OCL.
381381
- **Issue checklist sync**: `<issue-url>``<newly-ticked>` newly ticked,
382382
`<newly-added>` newly added, `<ticked>/<total>` total (filled in after step 11).
383+
- **Pre-filled commit message** (MANDATORY — append at the very end of the
384+
final-summary message in a fenced code block, ready to copy):
385+
386+
```
387+
Fix #<n>
388+
```
389+
390+
Where `<n>` is the GitHub issue number handled by this run. Nothing else —
391+
no body paragraphs, no per-method bullet list, no `Co-Authored-By` trailer,
392+
no "🤖 Generated with …" footer. The single line is the entire message.
383393

384394
Do NOT auto-commit. The user reviews and commits.
385395

.claude/team-templates/extension-impl.md

Lines changed: 20 additions & 233 deletions
Large diffs are not rendered by default.
Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,52 @@
1-
// -------------------------------------------------------------------------------------------------
1+
// -------------------------------------------------------------------------------------------------
22
// <copyright file="AnalysisCaseDefinitionExtensionsTestFixture.cs" company="Starion Group S.A.">
3-
//
3+
//
44
// Copyright 2022-2026 Starion Group S.A.
5-
//
5+
//
66
// Licensed under the Apache License, Version 2.0 (the "License");
77
// you may not use this file except in compliance with the License.
88
// You may obtain a copy of the License at
9-
//
9+
//
1010
// http://www.apache.org/licenses/LICENSE-2.0
11-
//
11+
//
1212
// Unless required by applicable law or agreed to in writing, software
1313
// distributed under the License is distributed on an "AS IS" BASIS,
1414
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515
// See the License for the specific language governing permissions and
1616
// limitations under the License.
17-
//
17+
//
1818
// </copyright>
1919
// ------------------------------------------------------------------------------------------------
2020

2121
namespace SysML2.NET.Tests.Extend
2222
{
2323
using System;
24-
24+
2525
using NUnit.Framework;
26-
26+
27+
using SysML2.NET.Core.POCO.Kernel.Functions;
2728
using SysML2.NET.Core.POCO.Systems.AnalysisCases;
29+
using SysML2.NET.Extensions;
2830

2931
[TestFixture]
3032
public class AnalysisCaseDefinitionExtensionsTestFixture
3133
{
3234
[Test]
33-
public void ComputeResultExpression_ThrowsNotSupportedException()
35+
public void VerifyComputeResultExpression()
3436
{
35-
Assert.That(() => ((IAnalysisCaseDefinition)null).ComputeResultExpression(), Throws.TypeOf<NotSupportedException>());
37+
Assert.That(() => ((IAnalysisCaseDefinition)null).ComputeResultExpression(), Throws.TypeOf<ArgumentNullException>());
38+
39+
var analysisCaseDefinition = new AnalysisCaseDefinition();
40+
41+
// Empty case: no ResultExpressionMembership in featureMembership → null.
42+
Assert.That(analysisCaseDefinition.ComputeResultExpression(), Is.Null);
43+
44+
// Populated case: ResultExpressionMembership owns an Expression → returns the Expression.
45+
var expression = new Expression();
46+
var resultExpressionMembership = new ResultExpressionMembership();
47+
analysisCaseDefinition.AssignOwnership(resultExpressionMembership, expression);
48+
49+
Assert.That(analysisCaseDefinition.ComputeResultExpression(), Is.SameAs(expression));
3650
}
3751
}
3852
}
Lines changed: 47 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,78 @@
1-
// -------------------------------------------------------------------------------------------------
1+
// -------------------------------------------------------------------------------------------------
22
// <copyright file="AnalysisCaseUsageExtensionsTestFixture.cs" company="Starion Group S.A.">
3-
//
3+
//
44
// Copyright 2022-2026 Starion Group S.A.
5-
//
5+
//
66
// Licensed under the Apache License, Version 2.0 (the "License");
77
// you may not use this file except in compliance with the License.
88
// You may obtain a copy of the License at
9-
//
9+
//
1010
// http://www.apache.org/licenses/LICENSE-2.0
11-
//
11+
//
1212
// Unless required by applicable law or agreed to in writing, software
1313
// distributed under the License is distributed on an "AS IS" BASIS,
1414
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515
// See the License for the specific language governing permissions and
1616
// limitations under the License.
17-
//
17+
//
1818
// </copyright>
1919
// ------------------------------------------------------------------------------------------------
2020

2121
namespace SysML2.NET.Tests.Extend
2222
{
2323
using System;
24-
24+
2525
using NUnit.Framework;
26-
26+
27+
using SysML2.NET.Core.POCO.Core.Features;
28+
using SysML2.NET.Core.POCO.Kernel.Functions;
2729
using SysML2.NET.Core.POCO.Systems.AnalysisCases;
30+
using SysML2.NET.Core.POCO.Systems.DefinitionAndUsage;
31+
using SysML2.NET.Extensions;
2832

2933
[TestFixture]
3034
public class AnalysisCaseUsageExtensionsTestFixture
3135
{
3236
[Test]
33-
public void ComputeAnalysisCaseDefinition_ThrowsNotSupportedException()
37+
public void VerifyComputeAnalysisCaseDefinition()
3438
{
35-
Assert.That(() => ((IAnalysisCaseUsage)null).ComputeAnalysisCaseDefinition(), Throws.TypeOf<NotSupportedException>());
39+
Assert.That(() => ((IAnalysisCaseUsage)null).ComputeAnalysisCaseDefinition(), Throws.TypeOf<ArgumentNullException>());
40+
41+
var analysisCaseUsage = new AnalysisCaseUsage();
42+
43+
// Empty case: no FeatureTyping whose Type is an IAnalysisCaseDefinition → null.
44+
Assert.That(analysisCaseUsage.ComputeAnalysisCaseDefinition(), Is.Null);
45+
46+
// Negative case: FeatureTyping whose Type is a Usage (not IAnalysisCaseDefinition) — no match → null.
47+
var nonDefinitionTyping = new FeatureTyping { Type = new Usage() };
48+
analysisCaseUsage.AssignOwnership(nonDefinitionTyping);
49+
50+
Assert.That(analysisCaseUsage.ComputeAnalysisCaseDefinition(), Is.Null);
51+
52+
// Populated case: FeatureTyping whose Type is an AnalysisCaseDefinition → returns the AnalysisCaseDefinition.
53+
var analysisCaseDefinition = new AnalysisCaseDefinition();
54+
var analysisCaseDefinitionTyping = new FeatureTyping { Type = analysisCaseDefinition };
55+
analysisCaseUsage.AssignOwnership(analysisCaseDefinitionTyping);
56+
57+
Assert.That(analysisCaseUsage.ComputeAnalysisCaseDefinition(), Is.SameAs(analysisCaseDefinition));
3658
}
37-
59+
3860
[Test]
39-
public void ComputeResultExpression_ThrowsNotSupportedException()
61+
public void VerifyComputeResultExpression()
4062
{
41-
Assert.That(() => ((IAnalysisCaseUsage)null).ComputeResultExpression(), Throws.TypeOf<NotSupportedException>());
63+
Assert.That(() => ((IAnalysisCaseUsage)null).ComputeResultExpression(), Throws.TypeOf<ArgumentNullException>());
64+
65+
var analysisCaseUsage = new AnalysisCaseUsage();
66+
67+
// Empty case: no ResultExpressionMembership in featureMembership → null.
68+
Assert.That(analysisCaseUsage.ComputeResultExpression(), Is.Null);
69+
70+
// Populated case: ResultExpressionMembership owns an Expression → returns the Expression.
71+
var expression = new Expression();
72+
var resultExpressionMembership = new ResultExpressionMembership();
73+
analysisCaseUsage.AssignOwnership(resultExpressionMembership, expression);
74+
75+
Assert.That(analysisCaseUsage.ComputeResultExpression(), Is.SameAs(expression));
4276
}
4377
}
4478
}
Lines changed: 77 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,112 @@
11
// -------------------------------------------------------------------------------------------------
22
// <copyright file="CaseDefinitionExtensionsTestFixture.cs" company="Starion Group S.A.">
3-
//
3+
//
44
// Copyright 2022-2026 Starion Group S.A.
5-
//
5+
//
66
// Licensed under the Apache License, Version 2.0 (the "License");
77
// you may not use this file except in compliance with the License.
88
// You may obtain a copy of the License at
9-
//
9+
//
1010
// http://www.apache.org/licenses/LICENSE-2.0
11-
//
11+
//
1212
// Unless required by applicable law or agreed to in writing, software
1313
// distributed under the License is distributed on an "AS IS" BASIS,
1414
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515
// See the License for the specific language governing permissions and
1616
// limitations under the License.
17-
//
17+
//
1818
// </copyright>
1919
// ------------------------------------------------------------------------------------------------
2020

2121
namespace SysML2.NET.Tests.Extend
2222
{
2323
using System;
24-
24+
2525
using NUnit.Framework;
2626

27-
using SysML2.NET.Core.POCO.Systems.Cases ;
27+
using SysML2.NET.Core.POCO.Kernel.Behaviors;
28+
using SysML2.NET.Core.POCO.Systems.Cases;
29+
using SysML2.NET.Core.POCO.Systems.Parts;
30+
using SysML2.NET.Core.POCO.Systems.Requirements;
31+
using SysML2.NET.Core.POCO.Systems.DefinitionAndUsage;
32+
using SysML2.NET.Extensions;
2833

2934
[TestFixture]
3035
public class CaseDefinitionExtensionsTestFixture
3136
{
3237
[Test]
33-
public void ComputeActorParameter_ThrowsNotSupportedException()
38+
public void VerifyComputeActorParameter()
3439
{
35-
Assert.That(() => ((ICaseDefinition)null).ComputeActorParameter(), Throws.TypeOf<NotSupportedException>());
40+
Assert.That(() => ((ICaseDefinition)null).ComputeActorParameter(), Throws.TypeOf<ArgumentNullException>());
41+
42+
var caseDefinition = new CaseDefinition();
43+
44+
Assert.That(caseDefinition.ComputeActorParameter(), Is.Empty);
45+
46+
// Discrimination: add a ParameterMembership (not ActorMembership) — must be excluded from result.
47+
var parameterMembership = new ParameterMembership();
48+
var parameterUsage = new Usage();
49+
caseDefinition.AssignOwnership(parameterMembership, parameterUsage);
50+
51+
Assert.That(caseDefinition.ComputeActorParameter(), Is.Empty);
52+
53+
// For Later: populated case depends on IActorMembership.ComputeOwnedActorParameter, which is still a stub.
54+
var actorMembership = new ActorMembership();
55+
var actorPartUsage = new PartUsage();
56+
caseDefinition.AssignOwnership(actorMembership, actorPartUsage);
57+
58+
Assert.That(() => caseDefinition.ComputeActorParameter(), Throws.TypeOf<NotSupportedException>());
3659
}
37-
60+
3861
[Test]
39-
public void ComputeObjectiveRequirement_ThrowsNotSupportedException()
62+
public void VerifyComputeObjectiveRequirement()
4063
{
41-
Assert.That(() => ((ICaseDefinition)null).ComputeObjectiveRequirement(), Throws.TypeOf<NotSupportedException>());
64+
Assert.That(() => ((ICaseDefinition)null).ComputeObjectiveRequirement(), Throws.TypeOf<ArgumentNullException>());
65+
66+
var caseDefinition = new CaseDefinition();
67+
68+
// Empty case: no ObjectiveMembership in featureMembership → null.
69+
Assert.That(caseDefinition.ComputeObjectiveRequirement(), Is.Null);
70+
71+
// Discrimination: add a ParameterMembership (not ObjectiveMembership) — still null.
72+
var parameterMembership = new ParameterMembership();
73+
var parameterUsage = new Usage();
74+
caseDefinition.AssignOwnership(parameterMembership, parameterUsage);
75+
76+
Assert.That(caseDefinition.ComputeObjectiveRequirement(), Is.Null);
77+
78+
// Populated case: ObjectiveMembership owns a RequirementUsage → returns the RequirementUsage.
79+
var objectiveMembership = new ObjectiveMembership();
80+
var requirementUsage = new RequirementUsage();
81+
caseDefinition.AssignOwnership(objectiveMembership, requirementUsage);
82+
83+
Assert.That(caseDefinition.ComputeObjectiveRequirement(), Is.SameAs(requirementUsage));
4284
}
43-
85+
4486
[Test]
45-
public void ComputeSubjectParameter_ThrowsNotSupportedException()
87+
public void VerifyComputeSubjectParameter()
4688
{
47-
Assert.That(() => ((ICaseDefinition)null).ComputeSubjectParameter(), Throws.TypeOf<NotSupportedException>());
89+
Assert.That(() => ((ICaseDefinition)null).ComputeSubjectParameter(), Throws.TypeOf<ArgumentNullException>());
90+
91+
var caseDefinition = new CaseDefinition();
92+
93+
// Empty case: no SubjectMembership in featureMembership → null.
94+
Assert.That(caseDefinition.ComputeSubjectParameter(), Is.Null);
95+
96+
// Discrimination: add a ParameterMembership (not SubjectMembership) → still null.
97+
var parameterMembership = new ParameterMembership();
98+
var parameterUsage = new Usage();
99+
caseDefinition.AssignOwnership(parameterMembership, parameterUsage);
100+
101+
Assert.That(caseDefinition.ComputeSubjectParameter(), Is.Null);
102+
103+
// Populated case: SubjectMembership is present alongside the earlier ParameterMembership.
104+
// OfType<ISubjectMembership> must discriminate — only the subject's ownedSubjectParameter surfaces.
105+
var subjectMembership = new SubjectMembership();
106+
var subjectUsage = new Usage();
107+
caseDefinition.AssignOwnership(subjectMembership, subjectUsage);
108+
109+
Assert.That(caseDefinition.ComputeSubjectParameter(), Is.SameAs(subjectUsage));
48110
}
49111
}
50112
}

0 commit comments

Comments
 (0)