From 349fd19ad0ca11fe89fa8de24281d8a588213537 Mon Sep 17 00:00:00 2001 From: Steve Pearson Date: Sun, 1 Mar 2026 21:04:52 +0000 Subject: [PATCH] Spurious character in test name preventing build --- .../UnitTests/NestedExpandExpressionTests.cs | 340 +++++++++--------- 1 file changed, 170 insertions(+), 170 deletions(-) diff --git a/PanoramicData.OData.Client.Test/UnitTests/NestedExpandExpressionTests.cs b/PanoramicData.OData.Client.Test/UnitTests/NestedExpandExpressionTests.cs index 58b4707..bdcc3b4 100644 --- a/PanoramicData.OData.Client.Test/UnitTests/NestedExpandExpressionTests.cs +++ b/PanoramicData.OData.Client.Test/UnitTests/NestedExpandExpressionTests.cs @@ -1,170 +1,170 @@ -namespace PanoramicData.OData.Client.Test.UnitTests; - -/// -/// Tests for nested $expand expressions using anonymous types. -/// See: https://github.com/panoramicdata/PanoramicData.OData.Client/issues/3 -/// -public class NestedExpandExpressionTests -{ - /// - /// Tests that a nested expand via anonymous type produces correct OData syntax. - /// Example: p => new { p.CurrentTenant, p.CurrentTenant!.Subscriptions } - /// Should produce: $expand=CurrentTenant($expand=Subscriptions) - /// - [Fact] - public void Expand_WithNestedPropertyInAnonymousType_ProducesNestedExpandSyntax() - { - // Arrange - var builder = new ODataQueryBuilder("People", NullLogger.Instance); - - // Act - This is the pattern from issue 3 - var url = builder - .Expand(p => new { p.BestFriend, p.BestFriend!.Trips }) - .BuildUrl(); - - // Assert - Should produce nested $expand syntax - url.Should().Contain("$expand=BestFriend($expand=Trips)"); - } - - /// - /// Tests that a single nested expand produces correct OData syntax. - /// Example: p => p.BestFriend!.Trips - /// Should produce: $expand=BestFriend($expand=Trips) - /// - [Fact] - public void Expand_WithSingleNestedProperty_ProducesNestedExpandSyntax() - { - // Arrange - var builder = new ODataQueryBuilder("People", NullLogger.Instance); - - // Act - var url = builder - .Expand(p => p.BestFriend!.Trips!) - .BuildUrl(); - - // Assert - url.Should().Contain("$expand=BestFriend($expand=Trips)"); - } - - /// - /// Tests that multiple independent expands still work correctly. - /// - [Fact] - public void Expand_WithMultipleIndependentProperties_ProducesCommaSepa­ratedExpands() - { - // Arrange - var builder = new ODataQueryBuilder("People", NullLogger.Instance); - - // Act - var url = builder - .Expand(p => new { p.BestFriend, p.Trips }) - .BuildUrl(); - - // Assert - Should produce comma-separated list - url.Should().Contain("$expand="); - url.Should().Contain("BestFriend"); - url.Should().Contain("Trips"); - } - - /// - /// Tests that a simple single property expand still works. - /// - [Fact] - public void Expand_WithSingleProperty_ProducesSimpleExpand() - { - // Arrange - var builder = new ODataQueryBuilder("People", NullLogger.Instance); - - // Act - var url = builder - .Expand(p => p.BestFriend!) - .BuildUrl(); - - // Assert - url.Should().Be("People?$expand=BestFriend"); - } - - /// - /// Tests that deeply nested expands work (3 levels). - /// Example: p => p.BestFriend!.BestFriend!.Trips - /// Should produce: $expand=BestFriend($expand=BestFriend($expand=Trips)) - /// - [Fact] - public void Expand_WithDeeplyNestedProperty_ProducesMultiLevelNestedExpand() - { - // Arrange - var builder = new ODataQueryBuilder("People", NullLogger.Instance); - - // Act - var url = builder - .Expand(p => p.BestFriend!.BestFriend!.Trips!) - .BuildUrl(); - - // Assert - url.Should().Contain("$expand=BestFriend($expand=BestFriend($expand=Trips))"); - } - - /// - /// Tests combining nested expands via anonymous type at different levels. - /// Example: p => new { p.BestFriend, p.BestFriend!.Trips, p.Friends } - /// Should produce: $expand=BestFriend($expand=Trips),Friends - /// - [Fact] - public void Expand_WithMixedNestedAndSimpleInAnonymousType_ProducesCorrectSyntax() - { - // Arrange - var builder = new ODataQueryBuilder("People", NullLogger.Instance); - - // Act - var url = builder - .Expand(p => new { p.BestFriend, p.BestFriend!.Trips, p.Friends }) - .BuildUrl(); - - // Assert - url.Should().Contain("$expand="); - url.Should().Contain("BestFriend($expand=Trips)"); - url.Should().Contain("Friends"); - } - - /// - /// Tests that the parent navigation property doesn't need to be explicitly included - /// when only the nested property is specified. - /// Example: p => p.BestFriend!.Trips should still work - /// - [Fact] - public void Expand_WithOnlyNestedProperty_ImpliesParentExpand() - { - // Arrange - var builder = new ODataQueryBuilder("People", NullLogger.Instance); - - // Act - var url = builder - .Expand(p => p.BestFriend!.Friends!) - .BuildUrl(); - - // Assert - Parent should be implied - url.Should().Contain("$expand=BestFriend($expand=Friends)"); - } - - /// - /// Tests that multiple nested paths under the same parent are combined. - /// Example: p => new { p.BestFriend!.Trips, p.BestFriend!.Friends } - /// Should produce: $expand=BestFriend($expand=Trips,Friends) or similar valid syntax - /// - [Fact] - public void Expand_WithMultipleNestedPathsUnderSameParent_CombinesCorrectly() - { - // Arrange - var builder = new ODataQueryBuilder("People", NullLogger.Instance); - - // Act - var url = builder - .Expand(p => new { p.BestFriend!.Trips, p.BestFriend!.Friends }) - .BuildUrl(); - - // Assert - Should combine nested expands under same parent - url.Should().Contain("$expand=BestFriend($expand="); - url.Should().Contain("Trips"); - url.Should().Contain("Friends"); - } -} +namespace PanoramicData.OData.Client.Test.UnitTests; + +/// +/// Tests for nested $expand expressions using anonymous types. +/// See: https://github.com/panoramicdata/PanoramicData.OData.Client/issues/3 +/// +public class NestedExpandExpressionTests +{ + /// + /// Tests that a nested expand via anonymous type produces correct OData syntax. + /// Example: p => new { p.CurrentTenant, p.CurrentTenant!.Subscriptions } + /// Should produce: $expand=CurrentTenant($expand=Subscriptions) + /// + [Fact] + public void Expand_WithNestedPropertyInAnonymousType_ProducesNestedExpandSyntax() + { + // Arrange + var builder = new ODataQueryBuilder("People", NullLogger.Instance); + + // Act - This is the pattern from issue 3 + var url = builder + .Expand(p => new { p.BestFriend, p.BestFriend!.Trips }) + .BuildUrl(); + + // Assert - Should produce nested $expand syntax + url.Should().Contain("$expand=BestFriend($expand=Trips)"); + } + + /// + /// Tests that a single nested expand produces correct OData syntax. + /// Example: p => p.BestFriend!.Trips + /// Should produce: $expand=BestFriend($expand=Trips) + /// + [Fact] + public void Expand_WithSingleNestedProperty_ProducesNestedExpandSyntax() + { + // Arrange + var builder = new ODataQueryBuilder("People", NullLogger.Instance); + + // Act + var url = builder + .Expand(p => p.BestFriend!.Trips!) + .BuildUrl(); + + // Assert + url.Should().Contain("$expand=BestFriend($expand=Trips)"); + } + + /// + /// Tests that multiple independent expands still work correctly. + /// + [Fact] + public void Expand_WithMultipleIndependentProperties_ProducesCommaSeparatedExpands() + { + // Arrange + var builder = new ODataQueryBuilder("People", NullLogger.Instance); + + // Act + var url = builder + .Expand(p => new { p.BestFriend, p.Trips }) + .BuildUrl(); + + // Assert - Should produce comma-separated list + url.Should().Contain("$expand="); + url.Should().Contain("BestFriend"); + url.Should().Contain("Trips"); + } + + /// + /// Tests that a simple single property expand still works. + /// + [Fact] + public void Expand_WithSingleProperty_ProducesSimpleExpand() + { + // Arrange + var builder = new ODataQueryBuilder("People", NullLogger.Instance); + + // Act + var url = builder + .Expand(p => p.BestFriend!) + .BuildUrl(); + + // Assert + url.Should().Be("People?$expand=BestFriend"); + } + + /// + /// Tests that deeply nested expands work (3 levels). + /// Example: p => p.BestFriend!.BestFriend!.Trips + /// Should produce: $expand=BestFriend($expand=BestFriend($expand=Trips)) + /// + [Fact] + public void Expand_WithDeeplyNestedProperty_ProducesMultiLevelNestedExpand() + { + // Arrange + var builder = new ODataQueryBuilder("People", NullLogger.Instance); + + // Act + var url = builder + .Expand(p => p.BestFriend!.BestFriend!.Trips!) + .BuildUrl(); + + // Assert + url.Should().Contain("$expand=BestFriend($expand=BestFriend($expand=Trips))"); + } + + /// + /// Tests combining nested expands via anonymous type at different levels. + /// Example: p => new { p.BestFriend, p.BestFriend!.Trips, p.Friends } + /// Should produce: $expand=BestFriend($expand=Trips),Friends + /// + [Fact] + public void Expand_WithMixedNestedAndSimpleInAnonymousType_ProducesCorrectSyntax() + { + // Arrange + var builder = new ODataQueryBuilder("People", NullLogger.Instance); + + // Act + var url = builder + .Expand(p => new { p.BestFriend, p.BestFriend!.Trips, p.Friends }) + .BuildUrl(); + + // Assert + url.Should().Contain("$expand="); + url.Should().Contain("BestFriend($expand=Trips)"); + url.Should().Contain("Friends"); + } + + /// + /// Tests that the parent navigation property doesn't need to be explicitly included + /// when only the nested property is specified. + /// Example: p => p.BestFriend!.Trips should still work + /// + [Fact] + public void Expand_WithOnlyNestedProperty_ImpliesParentExpand() + { + // Arrange + var builder = new ODataQueryBuilder("People", NullLogger.Instance); + + // Act + var url = builder + .Expand(p => p.BestFriend!.Friends!) + .BuildUrl(); + + // Assert - Parent should be implied + url.Should().Contain("$expand=BestFriend($expand=Friends)"); + } + + /// + /// Tests that multiple nested paths under the same parent are combined. + /// Example: p => new { p.BestFriend!.Trips, p.BestFriend!.Friends } + /// Should produce: $expand=BestFriend($expand=Trips,Friends) or similar valid syntax + /// + [Fact] + public void Expand_WithMultipleNestedPathsUnderSameParent_CombinesCorrectly() + { + // Arrange + var builder = new ODataQueryBuilder("People", NullLogger.Instance); + + // Act + var url = builder + .Expand(p => new { p.BestFriend!.Trips, p.BestFriend!.Friends }) + .BuildUrl(); + + // Assert - Should combine nested expands under same parent + url.Should().Contain("$expand=BestFriend($expand="); + url.Should().Contain("Trips"); + url.Should().Contain("Friends"); + } +}