Repository: Azure/azure-sdk-for-net
File: sdk/provisioning/Azure.Provisioning/tests/BicepMetadataTests.cs (C#)

Code before:
using Azure.Provisioning.Storage;
using Azure.Provisioning.Tests;
using NUnit.Framework;

namespace Azure.Provisioning.Tests;

public class BicepMetadataTests
{
    [Test]
    public void BicepMetadataDescriptionTest()
    {
        Infrastructure infra = new();

        StorageAccount storage = new("storage", StorageAccount.ResourceVersions.V2023_01_01)
        {
            Kind = StorageKind.StorageV2,
            Sku = { Name = StorageSkuName.StandardLrs }
        };
        storage.BicepMetadata.Description = "Production storage account";
        infra.Add(storage);

        ProvisioningPlan plan = infra.Build();
        string bicep = plan.Compile()["main.bicep"];

        Assert.That(bicep, Does.Contain("@description('Production storage account')"));
        Assert.That(bicep, Does.Contain("resource storage 'Microsoft.Storage/storageAccounts@2023-01-01'"));
    }

    [Test]
    public void BicepMetadataConditionTest()
    {
        Infrastructure infra = new();

        ProvisioningParameter deployStorage = new("deployStorage", typeof(bool)) { Value = true };
        infra.Add(deployStorage);

        StorageAccount storage = new("storage", StorageAccount.ResourceVersions.V2023_01_01)
        {
            Kind = StorageKind.StorageV2,
            Sku = { Name = StorageSkuName.StandardLrs }
        };
        storage.BicepMetadata.Condition = "deployStorage";
        infra.Add(storage);

        ProvisioningPlan plan = infra.Build();
        string bicep = plan.Compile()["main.bicep"];

        Assert.That(bicep, Does.Contain("= if (deployStorage)"));
    }

    [Test]

Review comment (suggestion):
we are using a `Trycep` class for testing.
Could you change the tests here using that?
it should be something like this:
```
var test = new Trycep()
.Define(
ctx => {
// put your code here, this callback should return an infra
})
.Compare(
// put your expected bicep here
);
```

Code after:
using NUnit.Framework;

namespace Azure.Provisioning.Tests;

public class BicepMetadataTests
{
    [Test]
    public void BicepMetadataDescriptionTest()
    {
        new Trycep()
            .Define(ctx =>
            {
                Infrastructure infra = new();

                StorageAccount storage = new("storage", StorageAccount.ResourceVersions.V2023_01_01)
                {
                    Kind = StorageKind.StorageV2,
                    Sku = { Name = StorageSkuName.StandardLrs }
                };
                storage.BicepMetadata.Description = "Production storage account";
                infra.Add(storage);

                return infra;
            })
            .Compare(
                """
                @description('The location for the resource(s) to be deployed.')
                param location string = resourceGroup().location

                @description('Production storage account')
                resource storage 'Microsoft.Storage/storageAccounts@2023-01-01' = {
                  name: take('storage${uniqueString(resourceGroup().id)}', 24)
                  kind: 'StorageV2'
                  location: location
                  sku: {
                    name: 'Standard_LRS'
                  }
                }
                """);
    }

    [Test]
    public void BicepMetadataBatchSizeTest()
    {
        new Trycep()
            .Define(ctx =>
            {
                Infrastructure infra = new();

                StorageAccount storage = new("storage", StorageAccount.ResourceVersions.V2023_01_01)
                {