Skip to content

Commit c2460bf

Browse files
Add CosmosClient instantiation in test projects to ensure SDK usage
Co-authored-by: kirankumarkolli <6880899+kirankumarkolli@users.noreply.github.com>
1 parent 5c932d1 commit c2460bf

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/MSBuild/CosmosTargetsPublishTests.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,17 @@ private string CreateTestProject(string projectName)
145145
</ItemGroup>
146146
</Project>");
147147

148-
// Create a minimal Program.cs
148+
// Create a minimal Program.cs that uses CosmosClient to ensure the SDK is properly referenced
149149
File.WriteAllText(programFile, @"using System;
150+
using Microsoft.Azure.Cosmos;
150151
151152
class Program
152153
{
153154
static void Main()
154155
{
155-
Console.WriteLine(""Hello from test project"");
156+
// Create a dummy CosmosClient to ensure the SDK is used and targets file is applied
157+
var client = new CosmosClient(""AccountEndpoint=https://localhost:8081/;AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw=="");
158+
Console.WriteLine($""CosmosClient created: {client != null}"");
156159
}
157160
}");
158161

0 commit comments

Comments
 (0)