File tree Expand file tree Collapse file tree
packages/http-client-csharp/emitter/test/Unit Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -355,6 +355,45 @@ describe("Next link operations", () => {
355355 `Expected model 'Foo' to be present in code model models. Found: ${ root . models . map ( ( m ) => m . name ) . join ( ", " ) } ` ,
356356 ) ;
357357 } ) ;
358+
359+ it ( "does not deduplicate enums with the same name but different namespaces" , async ( ) => {
360+ const program = await typeSpecCompile (
361+ `
362+ @convenientAPI(false)
363+ @list
364+ op link(): {
365+ @pageItems
366+ items: Foo[];
367+
368+ @nextLink
369+ next?: url;
370+ };
371+ enum Status { active, inactive };
372+ namespace Sub {
373+ enum Status { open, closed };
374+ }
375+ model Foo {
376+ name: string;
377+ a: Status;
378+ b: Sub.Status;
379+ };
380+ ` ,
381+ runner ,
382+ { IsTCGCNeeded : true } ,
383+ ) ;
384+ const context = createEmitterContext ( program ) ;
385+ const sdkContext = await createCSharpSdkContext ( context ) ;
386+ const [ root ] = createModel ( sdkContext ) ;
387+
388+ // Two enums share the name "Status" but live in different namespaces.
389+ // The namespace-aware dedup key must keep both in the code model.
390+ const statusEnums = root . enums . filter ( ( e ) => e . name === "Status" ) ;
391+ strictEqual (
392+ statusEnums . length ,
393+ 2 ,
394+ `Expected 2 'Status' enums from different namespaces. Found ${ statusEnums . length } : ${ root . enums . map ( ( e ) => `${ e . namespace } .${ e . name } ` ) . join ( ", " ) } ` ,
395+ ) ;
396+ } ) ;
358397} ) ;
359398
360399describe ( "Continuation token operations" , ( ) => {
You can’t perform that action at this time.
0 commit comments