Repository: Azure/azure-sdk-for-net
File: eng/packages/http-client-csharp-mgmt/emitter/test/non-resource-methods.test.ts (TypeScript)

Code before:
      "Should have exactly one non-resource method"
    );

    const method = nonResourceMethods[0];
    strictEqual(
      method.operationPath,
      "/subscriptions/{subscriptionId}/providers/Microsoft.ContosoProviderHub/locations/{location}/previewActions"
    );
    strictEqual(method.operationScope, ResourceScope.Subscription);

    // Validate using resolveArmResources API - use deep equality to ensure schemas match
    const resolvedSchema = resolveArmResources(program, sdkContext);
    ok(resolvedSchema);

    // Compare the entire schemas using deep equality
    deepStrictEqual(
      normalizeSchemaForComparison(resolvedSchema),
      normalizeSchemaForComparison(armProviderSchemaResult)
    );
  });

  it("should assign non-resource method to resource when operationPath has resource prefix", async () => {
    const program = await typeSpecCompile(
      `
/** A host pool resource */
model HostPool is TrackedResource<HostPoolProperties> {
  ...ResourceNameParameter<HostPool>;
}

/** Host pool properties */
model HostPoolProperties {
  /** Description */
  description?: string;
}

/** Session host provisioning status response */
model SessionHostProvisioningStatus {
  /** The provisioning status */
  status: string;
}

/** Standard ARM resource operations for HostPool */
@armResourceOperations
interface HostPools {
  get is ArmResourceRead<HostPool>;
  createOrUpdate is ArmResourceCreateOrReplaceAsync<HostPool>;
  delete is ArmResourceDeleteWithoutOkAsync<HostPool>;
  listByResourceGroup is ArmResourceListByParent<HostPool>;
}

/** Non-resource operations that sit under the HostPool path */

Review comment (suggestion):
Both newly added tests only assert results from `buildArmProviderSchema` (legacy path). They're missing the `resolveArmResources` validation and the `deepStrictEqual` comparison between both code paths.

Every other test in this file follows this pattern:

```typescript
// 1. Test legacy path
const armProviderSchema = buildArmProviderSchema(sdkContext, root);
// ... assertions ...

// 2. Test TypeSpec path
const resolvedSchema = resolveArmResources(program, sdkContext);
ok(resolvedSchema);

// 3. Ensure both paths produce the same result
deepStrictEqual(
  normalizeSchemaForComparison(resolvedSchema),
  normalizeSchemaForComparison(armProviderSchema)
);
```

Please add the `resolveArmResources` + `deepStrictEqual` comparison to both new tests to ensure `assignNonResourceMethodsToResources()` works correctly in both code paths.

Code after:
    strictEqual(
      nonResourceMethods.length,
      1,
      "Should have exactly one non-resource method"
    );

    const method = nonResourceMethods[0];
    strictEqual(
      method.operationPath,
      "/subscriptions/{subscriptionId}/providers/Microsoft.ContosoProviderHub/locations/{location}/previewActions"
    );
    strictEqual(method.operationScope, ResourceScope.Subscription);

    // Validate using resolveArmResources API - use deep equality to ensure schemas match
    const resolvedSchema = resolveArmResources(program, sdkContext);
    ok(resolvedSchema);

    // Compare the entire schemas using deep equality
    deepStrictEqual(
      normalizeSchemaForComparison(resolvedSchema),
      normalizeSchemaForComparison(armProviderSchemaResult)
    );
  });

  it("should assign non-resource method to resource when operationPath has resource prefix", async () => {
    const program = await typeSpecCompile(
      `
/** A host pool resource */
model HostPool is TrackedResource<HostPoolProperties> {
  ...ResourceNameParameter<HostPool>;
}

/** Host pool properties */
model HostPoolProperties {
  /** Description */
  description?: string;
}

/** Session host provisioning status response */
model SessionHostProvisioningStatus {
  /** The provisioning status */
  status: string;
}

/** Standard ARM resource operations for HostPool */
@armResourceOperations
interface HostPools {
  get is ArmResourceRead<HostPool>;
  createOrUpdate is ArmResourceCreateOrReplaceAsync<HostPool>;
  delete is ArmResourceDeleteWithoutOkAsync<HostPool>;
  listByResourceGroup is ArmResourceListByParent<HostPool>;