Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding test for VaultReplicationUsages API and corresponding test records. #179

Open
wants to merge 1 commit into
base: AutoRest-RS
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,15 @@ public List<VaultUsage> ListVaultUsages(string vaultName)
return VaultClient.VaultUsages.List(vaultName, resourceGroup).ToList();
}

/// <summary>
/// List vault replication usages.
/// </summary>
/// <returns>List of vault replication usages.</returns>
public List<ReplicationUsage> ListVaultReplicationUsages(string vaultName)
{
return VaultClient.ReplicationUsages.List(vaultName, resourceGroup).ToList();
}

#endregion VaultUsages

public void Dispose()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,36 @@ public void RetrieveVaultUsages()
}
}
}

[Fact]
public void RetrieveVaultReplicationUsages()
{
using (var context = MockContext.Start(this.GetType().FullName))
{
using (RecoveryServicesTestBase _testFixture = new RecoveryServicesTestBase(context))
{
string vaultName = VaultDefinition.TestCrud.VaultName;

_testFixture.CreateVault(vaultName);
var vault = _testFixture.GetVault(vaultName);
Assert.NotNull(vault);

var vaults = _testFixture.ListVaults();
Assert.NotNull(vaults);
Assert.NotEmpty(vaults);
Assert.True(vaults.Any(v => v.Name == vaultName));

var response = _testFixture.ListVaultReplicationUsages(vaultName);

Assert.NotNull(response);
foreach (var replicationUsage in response)
{
Assert.NotNull(replicationUsage.JobsSummary);
Assert.NotNull(replicationUsage.MonitoringSummary);
Assert.True(replicationUsage.ProtectedItemCount >=0 );
}
}
}
}
}
}
Loading