Repository: dotnet/efcore
File: test/EFCore.Cosmos.FunctionalTests/CosmosComplexTypesTrackingTest.cs (C#)

Code before:
    {
        if (!async)
        {
            throw SkipException.ForSkip("Cosmos does not support synchronous operations.");
        }

        return base.Can_save_null_second_level_complex_property_with_required_properties(async);
    }

    public override Task Can_save_null_third_level_complex_property_with_all_optional_properties(bool async)
    {
        if (!async)
        {
            throw SkipException.ForSkip("Cosmos does not support synchronous operations.");
        }

        return base.Can_save_null_third_level_complex_property_with_all_optional_properties(async);
    }
    
    protected override Task TrackAndSaveTest<TEntity>(EntityState state, bool async, Func<DbContext, TEntity> createPub)
    {
        if (!async)
        {
            throw SkipException.ForSkip("Cosmos does not support synchronous operations.");
        }

        return base.TrackAndSaveTest(state, async, createPub);
    }

    protected override async Task ExecuteWithStrategyInTransactionAsync(Func<DbContext, Task> testOperation, Func<DbContext, Task>? nestedTestOperation1 = null, Func<DbContext, Task>? nestedTestOperation2 = null, Func<DbContext, Task>? nestedTestOperation3 = null)
    {
        using var c = CreateContext();
        await c.Database.CreateExecutionStrategy().ExecuteAsync(
            c, async context =>
            {
                using (var innerContext = CreateContext())
                {
                    await testOperation(innerContext);
                }

                if (nestedTestOperation1 == null)
                {
                    return;
                }

                using (var innerContext1 = CreateContext())
                {
                    await nestedTestOperation1(innerContext1);
                }

                if (nestedTestOperation2 == null)

Review comment (bug):
@copilot  Microsoft.EntityFrameworkCore.CosmosComplexTypesTrackingTest.Throws_when_accessing_complex_entries_using_incorrect_cardinality [FAIL]
      System.InvalidOperationException : An error was generated for warning 'Microsoft.EntityFrameworkCore.Model.Validation.NoPartitionKeyDefined': No partition key has been configured for entity type 'EntityWithOptionalMultiPropComplex'. It is highly recommended that an appropriate partition key be defined. See https://aka.ms/efdocs-cosmos-partition-keys for more information. This exception can be suppressed or logged by passing event ID 'CosmosEventId.NoPartitionKeyDefined' to the 'ConfigureWarnings' method in 'DbContext.OnConfiguring' or 'AddDbContext'.

Code after:
            throw SkipException.ForSkip("Cosmos does not support synchronous operations.");
        }

        return base.Can_save_null_second_level_complex_property_with_required_properties(async);
    }

    public override Task Can_save_null_third_level_complex_property_with_all_optional_properties(bool async)
    {
        if (!async)
        {
            throw SkipException.ForSkip("Cosmos does not support synchronous operations.");
        }

        return base.Can_save_null_third_level_complex_property_with_all_optional_properties(async);
    }
    
    protected override Task TrackAndSaveTest<TEntity>(EntityState state, bool async, Func<DbContext, TEntity> createPub)
    {
        if (!async)
        {
            throw SkipException.ForSkip("Cosmos does not support synchronous operations.");
        }

        return base.TrackAndSaveTest(state, async, createPub);
    }

    public override Task Can_save_default_values_in_optional_complex_property_with_multiple_properties(bool async)
        // Optional complex properties are not supported on Cosmos
        // See https://github.com/dotnet/efcore/issues/31253
        => Task.CompletedTask;

    protected override async Task ExecuteWithStrategyInTransactionAsync(Func<DbContext, Task> testOperation, Func<DbContext, Task>? nestedTestOperation1 = null, Func<DbContext, Task>? nestedTestOperation2 = null, Func<DbContext, Task>? nestedTestOperation3 = null)
    {
        using var c = CreateContext();
        await c.Database.CreateExecutionStrategy().ExecuteAsync(
            c, async context =>
            {
                using (var innerContext = CreateContext())
                {
                    await testOperation(innerContext);
                }

                if (nestedTestOperation1 == null)
                {
                    return;
                }

                using (var innerContext1 = CreateContext())
                {
                    await nestedTestOperation1(innerContext1);
                }