diff --git a/Directory.Packages.props b/Directory.Packages.props index 8d1e23149..c4ddc91ed 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -1,13 +1,10 @@ - - - - true - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/SysML2.NET.CodeGenerator.Tests/HandleBarHelpers/ClassHelperTestFixture.cs b/SysML2.NET.CodeGenerator.Tests/HandleBarHelpers/ClassHelperTestFixture.cs index ee395080f..f342a863f 100644 --- a/SysML2.NET.CodeGenerator.Tests/HandleBarHelpers/ClassHelperTestFixture.cs +++ b/SysML2.NET.CodeGenerator.Tests/HandleBarHelpers/ClassHelperTestFixture.cs @@ -135,16 +135,6 @@ public void Verify_that_WriteCountAllNonDerivedProperties_writes_numeric_count() Assert.That(count, Is.GreaterThanOrEqualTo(0)); } - [Test] - public void Verify_that_QueryAllNonDerivedNonRedefinedProperties_does_not_throw() - { - var testClass = this.allClasses.First(c => !c.IsAbstract && c.QueryAllNonDerivedNonRedefinedProperties().Count > 0); - - Assert.That(() => this.RenderWithClassContext( - "{{#Class.QueryAllNonDerivedNonRedefinedProperties}}item{{/Class.QueryAllNonDerivedNonRedefinedProperties}}", - testClass), Throws.Nothing); - } - [Test] public void Verify_that_QueryAllNonDerivedNonRedefinedProperties_returns_expected_count() { diff --git a/SysML2.NET.CodeGenerator/Extensions/ClassExtensions.cs b/SysML2.NET.CodeGenerator/Extensions/ClassExtensions.cs index 9d8e0a0e9..ddbab62c8 100644 --- a/SysML2.NET.CodeGenerator/Extensions/ClassExtensions.cs +++ b/SysML2.NET.CodeGenerator/Extensions/ClassExtensions.cs @@ -9,7 +9,6 @@ namespace SysML2.NET.CodeGenerator.Extensions { - using System.Collections.ObjectModel; using System.Linq; using uml4net.Classification; @@ -21,45 +20,6 @@ namespace SysML2.NET.CodeGenerator.Extensions /// public static class ClassExtensions { - /// - /// Queries all the properties that are implemented by the class directly or through superclasses - /// or interface implementations EXCLUDING IsDerived - /// - /// - /// The from which to query the properties - /// - /// - /// A of - /// - public static ReadOnlyCollection QueryAllNonDerivedProperties(this IClass @class) - { - var properties = @class.QueryAllProperties() - .Where(x => !x.IsDerived); - - return properties.ToList().AsReadOnly(); - } - - /// - /// Queries all the properties that are implemented by the class directly or through superclasses - /// or interface implementations EXCLUDING IsDerived and EXCLUDING properties that have been - /// redefined in the context of the current class - /// - /// - /// The from which to query the properties - /// - /// - /// A of - /// - public static ReadOnlyCollection QueryAllNonDerivedNonRedefinedProperties(this IClass @class) - { - var properties = @class.QueryAllProperties() - .Where(x => !x.IsDerived) - .Where(x => !x.TryQueryRedefinedByProperty(@class, out _)) - .OrderBy(x => x.Name); - - return properties.ToList().AsReadOnly(); - } - /// /// Counts and returns to amount of non derived properties /// diff --git a/SysML2.NET.CodeGenerator/Extensions/PropertyExtension.cs b/SysML2.NET.CodeGenerator/Extensions/PropertyExtension.cs index aaf69b637..fbfb9d1c6 100644 --- a/SysML2.NET.CodeGenerator/Extensions/PropertyExtension.cs +++ b/SysML2.NET.CodeGenerator/Extensions/PropertyExtension.cs @@ -24,37 +24,6 @@ namespace SysML2.NET.CodeGenerator.Extensions /// public static class PropertyExtension { - /// - /// Asserts that the is an enum type with a default value provided - /// - /// The to assert - /// True if the have a default value for an enum - public static bool QueryIsEnumPropertyWithDefaultValue(this IProperty property) - { - ArgumentNullException.ThrowIfNull(property); - - if (!property.QueryIsEnum()) - { - return false; - } - - var defaultValue = property.QueryDefaultValueAsString(); - - if (defaultValue == "null") - { - return false; - } - - var valueSpecification = property.DefaultValue.FirstOrDefault(); - - if (valueSpecification is IInstanceValue instanceValue) - { - return instanceValue.Instance is IEnumerationLiteral; - } - - return false; - } - /// /// Gets the name of the property. /// diff --git a/SysML2.NET.CodeGenerator/HandleBarHelpers/ClassHelper.cs b/SysML2.NET.CodeGenerator/HandleBarHelpers/ClassHelper.cs index c17890632..0ede78f93 100644 --- a/SysML2.NET.CodeGenerator/HandleBarHelpers/ClassHelper.cs +++ b/SysML2.NET.CodeGenerator/HandleBarHelpers/ClassHelper.cs @@ -159,18 +159,6 @@ public static void RegisterClassHelper(this IHandlebars handlebars) writer.WriteSafeString(@class.CountAllNonDerivedProperties()); }); - // Queries all the properties that are non derived and not redefined in the - // context of the current class - handlebars.RegisterHelper("Class.QueryAllNonDerivedNonRedefinedProperties", (context, _) => - { - if (!(context.Value is IClass @class)) - { - throw new ArgumentException("#Class.QueryAllNonDerivedNonRedefinedProperties: supposed to be IClass"); - } - - return @class.QueryAllNonDerivedNonRedefinedProperties(); - }); - // writes the count of non-derived and non Redefined properties of the IClass handlebars.RegisterHelper("Class.WriteCountAllNonDerivedNonRedefinedProperties", (writer, context, _) => { diff --git a/SysML2.NET.Extensions.Tests/Utilities/StreamExtensionsTestFixture.cs b/SysML2.NET.Extensions.Tests/Utilities/StreamExtensionsTestFixture.cs index c22ad5641..0aea3db58 100644 --- a/SysML2.NET.Extensions.Tests/Utilities/StreamExtensionsTestFixture.cs +++ b/SysML2.NET.Extensions.Tests/Utilities/StreamExtensionsTestFixture.cs @@ -38,10 +38,8 @@ public async Task Verify_that_ReadAllBytesAsync_throws_on_null_stream() { Stream stream = null; - var ex = Assert.ThrowsAsync(async () => - await stream.ReadAllBytesAsync(CancellationToken.None)); - - Assert.That(ex!.ParamName, Is.EqualTo("stream")); + await Assert.ThatAsync(async () => await stream.ReadAllBytesAsync(CancellationToken.None), + Throws.ArgumentNullException.With.Property(nameof(ArgumentNullException.ParamName)).EqualTo("stream")); } [Test]