Conversation
Replaced obsolete `GetRdfTypes()[0]` calls with `GetTypes().First()` in `ETMSample.cs` and `EWMSample.cs`. This eliminates `CS0618` warnings related to `QmResource.GetRdfTypes` and `ChangeRequest.GetRdfTypes`. Co-authored-by: berezovskyi <64734+berezovskyi@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughReplaces legacy GetTypes()/SetTypes() accessors with a new public Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #608 +/- ##
==========================================
+ Coverage 50.86% 51.88% +1.02%
==========================================
Files 174 174
Lines 10202 10246 +44
Branches 1010 1019 +9
==========================================
+ Hits 5189 5316 +127
+ Misses 4756 4676 -80
+ Partials 257 254 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Introduced `Types` property in `IExtendedResource` and implemented it in `AbstractResource` and `AbstractResourceRecord`. - Marked `GetTypes` and `SetTypes` as `[Obsolete]` to encourage property usage. - Updated `AbstractResource.Types` setter to create a new `List<Uri>` to ensure safe modification. - Maintained `List<Uri>` return type in `AbstractResourceRecord.Types` via explicit interface implementation to avoid breaking changes. - Replaced all usages of `GetTypes()` and `SetTypes()` with `.Types` property across the codebase, including samples and client resources. - Eliminated `CS0618` warnings related to obsolete method calls. Co-authored-by: berezovskyi <64734+berezovskyi@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Fix all issues with AI agents
In `@OSLC4Net_SDK/OSLC4Net.Client/Oslc/Resources/ArchitectureLinkType.cs`:
- Around line 147-151: The Obsolete attribute messages contain a typo: change
"User" to "Use" in the Obsolete strings for the methods such as GetRdfTypes
(method name GetRdfTypes) and SetRdfTypes (method name SetRdfTypes) in
ArchitectureLinkType.cs and the corresponding obsolete attributes in other
resource files (AutomationPlan, AutomationRequest, AutomationResult,
ParameterInstance, QmResource, and both ChangeRequest files); update each
Obsolete("User GetTypes() or .Types instead") and Obsolete("User SetTypes() or
.Types instead") to Obsolete("Use GetTypes() or .Types instead") and
Obsolete("Use SetTypes() or .Types instead") respectively so the message reads
correctly.
In `@OSLC4Net_SDK/OSLC4Net.Client/Oslc/Resources/ArchitectureResource.cs`:
- Around line 236-239: The Obsolete attribute message on the SetRdfTypes method
has a typo; update the attribute string on the SetRdfTypes method in
ArchitectureResource (the [Obsolete("User SetTypes() or .Types instead")]
decoration) to read "Use SetTypes() or .Types instead" so the guidance
references "Use" not "User" while keeping the same target methods/properties
(SetTypes and Types).
- Around line 147-151: Replace the typo "User" with "Use" in the Obsolete
attribute messages across the resource classes; specifically update the Obsolete
strings on methods/properties like GetRdfTypes (returns Types.ToArray()), any
SetRdfTypes/SetTypes variants, and the corresponding GetTypes()/SetTypes()
messages so they read "Use GetTypes() or .Types instead" and "Use SetTypes() or
.Types instead" respectively; apply this change in the listed resource files and
the two occurrences per file (e.g., GetRdfTypes/GetTypes and
SetRdfTypes/SetTypes in AutomationRequest, ParameterInstance, RequirementBase,
QmResource, AutomationResult, ChangeRequest, AutomationPlan,
ArchitectureResource, ArchitectureLinkType).
In `@OSLC4Net_SDK/OSLC4Net.Client/Oslc/Resources/RequirementBase.cs`:
- Around line 390-394: The Obsolete attribute on the
RequirementBase.GetRdfTypes() method contains a typo ("User" should be "Use");
update the attribute string on GetRdfTypes() to read "[Obsolete(\"Use GetTypes()
or .Types instead\")]" so the message is correct and consistent with other
resource files.
🧹 Nitpick comments (2)
OSLC4Net_SDK/OSLC4Net.ChangeManagement/ChangeRequest.cs (1)
354-358: Inconsistent[Obsolete]attributes — missing guidance message.Unlike all other resource files in this PR (which include
"User GetTypes() or .Types instead"), the[Obsolete]attributes here onGetRdfTypes()(line 354) andSetRdfTypes()(line 716) have no message. Consider adding the same message (with the "Use" correction) so consumers see actionable guidance from the compiler warning.The delegation to
Typesis correct.Also applies to: 716-720
OSLC4Net_SDK/OSLC4Net.Client/Oslc/Resources/RequirementBase.cs (1)
57-57: Remove the unusedRdfTypesfield.The
protected readonly ISet<Uri> RdfTypesfield on line 57 is dead code. BothGetRdfTypes()andSetRdfTypes()(which are marked[Obsolete]) delegate to the inheritedTypesproperty instead, and the field is never referenced anywhere in the codebase. Removing it will eliminate confusion and improve clarity.
| [Obsolete("User GetTypes() or .Types instead")] | ||
| public Uri[] GetRdfTypes() | ||
| { | ||
| return GetTypes().ToArray(); | ||
| return Types.ToArray(); | ||
| } |
There was a problem hiding this comment.
Typo in [Obsolete] message: "User" → "Use".
The obsolete attribute messages on lines 147 and 212 say "User GetTypes()..." and "User SetTypes()..." — should be "Use". This same typo is repeated across all resource files in this PR (AutomationPlan, AutomationRequest, AutomationResult, ParameterInstance, QmResource, and both ChangeRequest files).
Proposed fix (this file)
- [Obsolete("User GetTypes() or .Types instead")]
+ [Obsolete("Use GetTypes() or .Types instead")]
public Uri[] GetRdfTypes()- [Obsolete("User SetTypes() or .Types instead")]
+ [Obsolete("Use SetTypes() or .Types instead")]
public void SetRdfTypes(Uri[] rdfTypes)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| [Obsolete("User GetTypes() or .Types instead")] | |
| public Uri[] GetRdfTypes() | |
| { | |
| return GetTypes().ToArray(); | |
| return Types.ToArray(); | |
| } | |
| [Obsolete("Use GetTypes() or .Types instead")] | |
| public Uri[] GetRdfTypes() | |
| { | |
| return Types.ToArray(); | |
| } |
🤖 Prompt for AI Agents
In `@OSLC4Net_SDK/OSLC4Net.Client/Oslc/Resources/ArchitectureLinkType.cs` around
lines 147 - 151, The Obsolete attribute messages contain a typo: change "User"
to "Use" in the Obsolete strings for the methods such as GetRdfTypes (method
name GetRdfTypes) and SetRdfTypes (method name SetRdfTypes) in
ArchitectureLinkType.cs and the corresponding obsolete attributes in other
resource files (AutomationPlan, AutomationRequest, AutomationResult,
ParameterInstance, QmResource, and both ChangeRequest files); update each
Obsolete("User GetTypes() or .Types instead") and Obsolete("User SetTypes() or
.Types instead") to Obsolete("Use GetTypes() or .Types instead") and
Obsolete("Use SetTypes() or .Types instead") respectively so the message reads
correctly.
| [Obsolete("User GetTypes() or .Types instead")] | ||
| public Uri[] GetRdfTypes() | ||
| { | ||
| return GetTypes().ToArray(); | ||
| return Types.ToArray(); | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
rg -n '"User [GS]etTypes' --type=csRepository: OSLC/oslc4net
Length of output: 2210
Fix typo in [Obsolete] messages: "User" → "Use".
Multiple resource files contain the typo "User GetTypes() or .Types instead" and "User SetTypes() or .Types instead" in their [Obsolete] attributes. The correct phrasing should use "Use" instead of "User".
This appears in 9 resource files with 18 total occurrences (2 per file):
- AutomationRequest.cs (lines 163, 306)
- ParameterInstance.cs (lines 95, 130)
- RequirementBase.cs (lines 390, 611)
- QmResource.cs (lines 90, 136)
- AutomationResult.cs (lines 173, 363)
- ChangeRequest.cs (lines 341, 696)
- AutomationPlan.cs (lines 153, 245)
- ArchitectureResource.cs (lines 147, 236)
- ArchitectureLinkType.cs (lines 147, 212)
🤖 Prompt for AI Agents
In `@OSLC4Net_SDK/OSLC4Net.Client/Oslc/Resources/ArchitectureResource.cs` around
lines 147 - 151, Replace the typo "User" with "Use" in the Obsolete attribute
messages across the resource classes; specifically update the Obsolete strings
on methods/properties like GetRdfTypes (returns Types.ToArray()), any
SetRdfTypes/SetTypes variants, and the corresponding GetTypes()/SetTypes()
messages so they read "Use GetTypes() or .Types instead" and "Use SetTypes() or
.Types instead" respectively; apply this change in the listed resource files and
the two occurrences per file (e.g., GetRdfTypes/GetTypes and
SetRdfTypes/SetTypes in AutomationRequest, ParameterInstance, RequirementBase,
QmResource, AutomationResult, ChangeRequest, AutomationPlan,
ArchitectureResource, ArchitectureLinkType).
| [Obsolete("User SetTypes() or .Types instead")] | ||
| public void SetRdfTypes(Uri[] rdfTypes) | ||
| { | ||
| SetTypes(rdfTypes); | ||
| Types = rdfTypes; |
There was a problem hiding this comment.
Same typo in the setter's [Obsolete] message.
"User SetTypes() or .Types instead" → "Use SetTypes() or .Types instead".
🤖 Prompt for AI Agents
In `@OSLC4Net_SDK/OSLC4Net.Client/Oslc/Resources/ArchitectureResource.cs` around
lines 236 - 239, The Obsolete attribute message on the SetRdfTypes method has a
typo; update the attribute string on the SetRdfTypes method in
ArchitectureResource (the [Obsolete("User SetTypes() or .Types instead")]
decoration) to read "Use SetTypes() or .Types instead" so the guidance
references "Use" not "User" while keeping the same target methods/properties
(SetTypes and Types).
| [Obsolete("User GetTypes() or .Types instead")] | ||
| public Uri[] GetRdfTypes() | ||
| { | ||
| return GetTypes().ToArray(); | ||
| return Types.ToArray(); | ||
| } |
There was a problem hiding this comment.
Same "User" → "Use" typo as in other resource files.
🤖 Prompt for AI Agents
In `@OSLC4Net_SDK/OSLC4Net.Client/Oslc/Resources/RequirementBase.cs` around lines
390 - 394, The Obsolete attribute on the RequirementBase.GetRdfTypes() method
contains a typo ("User" should be "Use"); update the attribute string on
GetRdfTypes() to read "[Obsolete(\"Use GetTypes() or .Types instead\")]" so the
message is correct and consistent with other resource files.
- Replaced `GetTypes()` and `SetTypes()` with `Types` property in `IExtendedResource`, `AbstractResource`, and `AbstractResourceRecord`. - Moved OSLC metadata attributes (`[OslcDescription]`, `[OslcName]`, `[OslcPropertyDefinition]`, `[OslcTitle]`) from `GetTypes()` method to the new `Types` property. - Updated `ResourceShapeFactory` to support inspecting both properties and methods for OSLC metadata, ensuring correct resource shape generation. - Marked legacy `GetTypes()` and `SetTypes()` methods as `[Obsolete]`. - Updated usage in `DotNetRdfHelper`, `ETMSample`, `EWMSample`, and generated resources to use `.Types`. - Ensured `AbstractResource.Types` setter performs a safe list copy. - Maintained `AbstractResourceRecord.Types` as `List<Uri>` via explicit interface implementation. Co-authored-by: berezovskyi <64734+berezovskyi@users.noreply.github.com>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
OSLC4Net_SDK/OSLC4Net.Core/Model/ResourceShapeFactory.cs (1)
173-205:⚠️ Potential issue | 🔴 Critical
GetComponentTypeandGetDefaultValueTypewill fail to compile — still expectMethodInfoinstead ofMemberInfo.
CreatePropertynow acceptsMemberInfo(line 173), but calls to helper methods pass this parameter without conversion:
- Line 219:
GetComponentType(resourceType, method, returnType)wheremethodisMemberInfo, butGetComponentType(line 428) signature is(Type, MethodInfo, Type)- Line 248:
GetDefaultValueType(resourceType, method, componentType)wheremethodisMemberInfo, butGetDefaultValueType(line 394) signature is(Type, MethodInfo, Type)Additionally,
OslcCoreInvalidPropertyTypeException(line 21 in exceptions file) still expectsMethodInfo method— this will also fail when called withMemberInfofrom helper methods.Update signatures for
GetComponentType,GetDefaultValueType, and the exception constructor to acceptMemberInfoinstead ofMethodInfo.
🧹 Nitpick comments (2)
OSLC4Net_SDK/OSLC4Net.Core/Model/AbstractResourceRecord.cs (1)
19-30: Consider usingIList<Uri>instead ofList<Uri>for the public property type.The public
Typesproperty (Line 24) exposes the concreteList<Uri>type, while the interface (IExtendedResource) declaresICollection<Uri>. Per Microsoft Framework Design Guidelines, public APIs should generally prefer collection interfaces over concrete types to reduce coupling and allow implementation flexibility.That said, the
private setlimits external mutation surface, and the explicit interface implementation on Lines 26-30 correctly bridges the types. This is a minor point.Optional: use IList<Uri> for the public property
- public List<Uri> Types { get; private set; } = new(); + public IList<Uri> Types { get; private set; } = new List<Uri>();As per coding guidelines, "Review the C# code against the Microsoft Framework design guidelines".
OSLC4Net_SDK/OSLC4Net.Core/Model/ResourceShapeFactory.cs (1)
200-205: DuplicatedMemberInforeturn-type extraction — consider extracting a helper.The same switch expression for deriving the return/property type from a
MemberInfoappears at Lines 200-205 and Lines 473-478. A small helper method (e.g.,GetMemberReturnType(MemberInfo)) would reduce duplication and make future maintenance easier. Note thatDotNetRdfHelper.csalready has a similarGetBackingMemberTypepattern.♻️ Proposed helper extraction
+ private static Type GetMemberReturnType(MemberInfo member) => member switch + { + MethodInfo m => m.ReturnType, + PropertyInfo p => p.PropertyType, + _ => throw new ArgumentException("Unsupported member type", nameof(member)) + };Then replace both switch expressions:
- var returnType = method switch - { - MethodInfo methodInfo => methodInfo.ReturnType, - PropertyInfo propertyInfo => propertyInfo.PropertyType, - _ => throw new ArgumentException("Unsupported member type", nameof(method)) - }; + var returnType = GetMemberReturnType(method);As per coding guidelines, "Building Maintainable Software" by Joost Visser recommends avoiding code duplication (DRY principle).
Also applies to: 470-478
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
OSLC4Net_SDK/Tests/OSLC4Net.Core.Tests/ResourceShapeFactoryTests.cs (1)
301-302:⚠️ Potential issue | 🟡 MinorStale comment contradicts the new behavior.
Lines 301–302 state "ResourceShapeFactory only supports getter/setter methods, not direct properties" and "Direct property pattern is not supported by ResourceShapeFactory." This is no longer accurate —
ResourceShapeFactorynow iteratesresourceType.GetProperties()and discovers property-based annotations.Proposed fix
- // Note: ResourceShapeFactory only supports getter/setter methods, not direct properties - // Direct property pattern is not supported by ResourceShapeFactory + // ResourceShapeFactory now supports both getter/setter methods and C# properties with OSLC annotations
🤖 Fix all issues with AI agents
In `@OSLC4Net_SDK/OSLC4Net.Core/Model/Property.cs`:
- Around line 62-72: The CompareTo method in class Property does not handle a
null argument and will throw on o.GetName(); update Property.CompareTo(Property
o) to first check if o is null and return a positive value (e.g., return 1) per
IComparable<T> contract, then proceed with the existing name and
propertyDefinition comparisons (using GetName() and o.propertyDefinition)
unchanged.
In
`@OSLC4Net_SDK/Tests/OSLC4Net.Core.DotNetRdfProviderTests/TypesPropertyRoundtripTests.cs`:
- Around line 52-68: The test Types_EmptyCollectionRoundtrips currently only
checks deserialization non-nullity; update it to assert the deserialized
ChangeRequest.Types collection is present and contains no extra user types (i.e.
only the resource shape's rdf:type). Specifically, in the
Types_EmptyCollectionRoundtrips test (method name
Types_EmptyCollectionRoundtrips) after calling
RdfHelpers.DeserializeAsync<ChangeRequest>, add assertions that
deserialized.Types is not null and that its Count equals the expected single
rdf:type (e.g. assert Has.Count.EqualTo(1) or equivalent) so the test verifies
no extra types were round-tripped for the ChangeRequest.Types property. Ensure
you reference the ChangeRequest.Types property when adding these assertions.
🧹 Nitpick comments (4)
OSLC4Net_SDK/OSLC4Net.Core/Exceptions/OslcCoreInvalidRepresentationException.cs (1)
19-27: Property nameMethodand error message text are misleading for non-method members.Since the parameter type was widened from
MethodInfotoMemberInfo, theMemberInfocould now represent aPropertyInfo. The property nameMethodand the error message fragment"for method {method.Name}"would be inaccurate in that case. Consider renaming the property toMemberand adjusting the message string accordingly. This applies to all four exception classes in this PR.♻️ Suggested rename
public class OslcCoreInvalidRepresentationException( Type resourceType, - MemberInfo method, + MemberInfo member, Representation representation) : OslcCoreApplicationException( - $"OSLC1006: Invalid representation {RepresentationExtension.ToString(representation)} defined for method {method.Name} of class {resourceType.Name}") + $"OSLC1006: Invalid representation {RepresentationExtension.ToString(representation)} defined for member {member.Name} of class {resourceType.Name}") { public Type ResourceType { get; } = resourceType; - public MemberInfo Method { get; } = method; + public MemberInfo Member { get; } = member; public Representation Representation { get; } = representation; }Note: renaming
Method→Memberis a breaking change for any code accessing the property. If backward compatibility is a concern, you could keep the old property as[Obsolete]and add the new one. As per coding guidelines, the Microsoft Framework Design Guidelines recommend that property names accurately describe their semantics.OSLC4Net_SDK/OSLC4Net.Core/Model/ResourceShapeFactory.cs (2)
150-169: No setter validation for property-based definitions.The method-based loop calls
ValidateSetMethodExists(line 144) to ensure a matching setter exists. The new property loop doesn't perform any analogous check. A read-only C# property (get-only) annotated with[OslcPropertyDefinition]would be silently accepted here but could fail at deserialization time.Consider adding a check for
prop.CanWriteorprop.GetSetMethod() != nulland throwing if the property isn't writable, or document that read-only properties are intentionally supported.
185-206: RepeatedMemberInfodispatch pattern.The
method switch { MethodInfo => ..., PropertyInfo => ... }pattern appears three times (lines 185, 201, 480). Consider extracting a small helper to reduce duplication:Example helper
private static Type GetReturnType(MemberInfo member) => member switch { MethodInfo m => m.ReturnType, PropertyInfo p => p.PropertyType, _ => throw new ArgumentException("Unsupported member type", nameof(member)) };Then replace inline switches at lines 201–206 and 480–485 with
GetReturnType(method).OSLC4Net_SDK/Tests/OSLC4Net.Core.DotNetRdfProviderTests/TypesPropertyRoundtripTests.cs (1)
1-1: Unusedusingdirective.
System.Net.Http.Headersdoes not appear to be directly referenced in this file.Proposed fix
-using System.Net.Http.Headers; using OSLC4Net.ChangeManagement;
| public int CompareTo(Property o) | ||
| { | ||
| return name.CompareTo(o.GetName()); | ||
| var nameComparison = string.Compare(name, o.GetName(), StringComparison.Ordinal); | ||
| if (nameComparison != 0) | ||
| { | ||
| return nameComparison; | ||
| } | ||
|
|
||
| return Uri.Compare(propertyDefinition, o.propertyDefinition, | ||
| UriComponents.AbsoluteUri, UriFormat.UriEscaped, StringComparison.Ordinal); | ||
| } |
There was a problem hiding this comment.
CompareTo does not guard against a null argument.
Per the .NET IComparable<T> contract, CompareTo(null) should return a positive value. Currently, passing null will throw a NullReferenceException on o.GetName().
Proposed fix
public int CompareTo(Property o)
{
+ if (o is null) return 1;
+
var nameComparison = string.Compare(name, o.GetName(), StringComparison.Ordinal);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| public int CompareTo(Property o) | |
| { | |
| return name.CompareTo(o.GetName()); | |
| var nameComparison = string.Compare(name, o.GetName(), StringComparison.Ordinal); | |
| if (nameComparison != 0) | |
| { | |
| return nameComparison; | |
| } | |
| return Uri.Compare(propertyDefinition, o.propertyDefinition, | |
| UriComponents.AbsoluteUri, UriFormat.UriEscaped, StringComparison.Ordinal); | |
| } | |
| public int CompareTo(Property o) | |
| { | |
| if (o is null) return 1; | |
| var nameComparison = string.Compare(name, o.GetName(), StringComparison.Ordinal); | |
| if (nameComparison != 0) | |
| { | |
| return nameComparison; | |
| } | |
| return Uri.Compare(propertyDefinition, o.propertyDefinition, | |
| UriComponents.AbsoluteUri, UriFormat.UriEscaped, StringComparison.Ordinal); | |
| } |
🤖 Prompt for AI Agents
In `@OSLC4Net_SDK/OSLC4Net.Core/Model/Property.cs` around lines 62 - 72, The
CompareTo method in class Property does not handle a null argument and will
throw on o.GetName(); update Property.CompareTo(Property o) to first check if o
is null and return a positive value (e.g., return 1) per IComparable<T>
contract, then proceed with the existing name and propertyDefinition comparisons
(using GetName() and o.propertyDefinition) unchanged.
| [Test] | ||
| public async Task Types_EmptyCollectionRoundtrips() | ||
| { | ||
| var cr = new ChangeRequest(new Uri("http://example.com/cr/3")); | ||
| // Don't set any types - should roundtrip as empty | ||
|
|
||
| var formatter = new RdfXmlMediaTypeFormatter(); | ||
| var rdfXml = await RdfHelpers.SerializeAsync(formatter, cr, | ||
| OslcMediaType.APPLICATION_RDF_XML_TYPE); | ||
|
|
||
| var deserialized = await RdfHelpers.DeserializeAsync<ChangeRequest>(formatter, rdfXml, | ||
| OslcMediaType.APPLICATION_RDF_XML_TYPE); | ||
|
|
||
| await Assert.That(deserialized).IsNotNull(); | ||
| // The ChangeRequest will have its own rdf:type from OslcResourceShape describes, | ||
| // but no extra types should appear beyond that | ||
| } |
There was a problem hiding this comment.
Empty collection roundtrip test has no meaningful assertion on Types.
The test comment on lines 66–67 says "no extra types should appear beyond that," but there is no assertion verifying the Types collection on the deserialized object. The test only checks that deserialization didn't return null.
Proposed assertion
await Assert.That(deserialized).IsNotNull();
// The ChangeRequest will have its own rdf:type from OslcResourceShape describes,
// but no extra types should appear beyond that
+ // Assert that no additional types were injected during roundtrip
+ await Assert.That(deserialized!.Types.Count).IsLessThanOrEqualTo(1);🤖 Prompt for AI Agents
In
`@OSLC4Net_SDK/Tests/OSLC4Net.Core.DotNetRdfProviderTests/TypesPropertyRoundtripTests.cs`
around lines 52 - 68, The test Types_EmptyCollectionRoundtrips currently only
checks deserialization non-nullity; update it to assert the deserialized
ChangeRequest.Types collection is present and contains no extra user types (i.e.
only the resource shape's rdf:type). Specifically, in the
Types_EmptyCollectionRoundtrips test (method name
Types_EmptyCollectionRoundtrips) after calling
RdfHelpers.DeserializeAsync<ChangeRequest>, add assertions that
deserialized.Types is not null and that its Count equals the expected single
rdf:type (e.g. assert Has.Count.EqualTo(1) or equivalent) so the test verifies
no extra types were round-tripped for the ChangeRequest.Types property. Ensure
you reference the ChangeRequest.Types property when adding these assertions.
Replaced obsolete
GetRdfTypes()[0]calls withGetTypes().First()inETMSample.csandEWMSample.cs.This eliminates
CS0618warnings related toQmResource.GetRdfTypesandChangeRequest.GetRdfTypes.PR created automatically by Jules for task 10586470375603891486 started by @berezovskyi
Summary by CodeRabbit
Refactor
New Features
Tests