Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ dotnet-coverage collect "dotnet test SysML2.NET.sln --no-build" -f xml -o covera

Test framework: **NUnit**. Test classes use `[TestFixture]` and `[Test]` attributes.

**When writing or modifying unit tests** in any `*.Tests/` project: read `TESTING.md` at the repo root for the NUnit conventions (one `[Test]` per method-under-test, `Assert.That` everywhere, `Assert.EnterMultipleScope` only for consecutive asserts, mandatory positive + negative coverage, assertion idiom preferences, `Verify{MethodUnderTest}` naming).

## Architecture

### Code Generation
Expand Down Expand Up @@ -155,3 +157,4 @@ Auto-generated DTOs use structured namespaces reflecting the KerML/SysML package
- Use meaningful variable names instead of single-letter names in any context (e.g., 'charIndex' instead of 'i', 'currentChar' instead of 'c', 'element' instead of 'e')
- Use 'NotSupportedException' (not 'NotImplementedException') for placeholder/stub methods that require manual implementation
- Prefer C# property patterns ('x is IType { Prop: value }') over declared-variable-plus-predicate form ('x is IType name && name.Prop == value') when the narrowed variable is only consulted once; the property-pattern form is more concise and intent-revealing
- Surround every braced block (`if`, `else if`, `while`, `for`, `foreach`, `switch`, `using`, `try`/`catch`/`finally`, `lock`, `do…while`, anonymous `{ }`) with a blank line on both sides — the rule does NOT apply at the very start/end of a method body, nor between a `}` and a continuation keyword (`else`, `catch`, `finally`, `while` of `do…while`) that belongs to the same control flow

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// -------------------------------------------------------------------------------------------------
// <copyright file="UmlCorePocoValidationGeneratorTestFixture.cs" company="Starion Group S.A.">
//
// Copyright 2022-2026 Starion Group S.A.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// </copyright>
// ------------------------------------------------------------------------------------------------

namespace SysML2.NET.CodeGenerator.Tests.Generators.UmlHandleBarsGenerators
{
using System.IO;
using System.Threading.Tasks;

using NUnit.Framework;

using SysML2.NET.CodeGenerator.Generators.UmlHandleBarsGenerators;

[TestFixture]
public class UmlCorePocoValidationGeneratorTestFixture
{
private DirectoryInfo outputDirectory;
private UmlCorePocoValidationGenerator generator;

[OneTimeSetUp]
public void OneTimeSetup()
{
var directoryInfo = new DirectoryInfo(TestContext.CurrentContext.TestDirectory);

var path = Path.Combine("UML", "_SysML2.NET.AutoGenExtensions.ElementExtensions");

this.outputDirectory = directoryInfo.CreateSubdirectory(path);
this.generator = new UmlCorePocoValidationGenerator();
}

[Test]
public async Task VerifyElementExtensionsAreGenerated()
{
await Assert.ThatAsync(
() => this.generator.GenerateAsync(GeneratorSetupFixture.XmiReaderResult, this.outputDirectory),
Throws.Nothing);
}

[Test]
[Category("Expected")]
public async Task VerifyExpectedElementExtensionsMatches()
{
var generatedCode = await this.generator.GenerateElementExtensions(
GeneratorSetupFixture.XmiReaderResult,
this.outputDirectory);

var expected = await File.ReadAllTextAsync(Path.Combine(TestContext.CurrentContext.TestDirectory,
"Expected/UML/Core/AutoGenExtensions/ElementExtensions.cs"));

Assert.That(generatedCode, Is.EqualTo(expected));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
<Compile Remove="Extensions\**" />
<EmbeddedResource Remove="Extensions\**" />
<None Remove="Extensions\**" />
<Compile Remove="Expected\UML\Core\AutoGenExtensions\ElementExtensions.cs" />
<Compile Remove="Expected\UML\Core\AutoGenReaders\AnnotatingElementReader.cs" />
<None Include="Expected\UML\Core\AutoGenExtensions\ElementExtensions.cs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Expected\UML\Core\AutoGenReaders\AnnotatingElementReader.cs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down
Loading
Loading