public CloudServiceClientTests()
{
AzurePowerShell.ProfileDirectory = Test.Utilities.Common.Data.AzureSdkAppDir;
storageService = new MockStorageService()
.Add(a => SetupStorage(serviceName.ToLowerInvariant(), a))
.Add(a => SetupStorage(storageName.ToLowerInvariant(), a));
services = new MockServicesHost()
.Add(s =>
{
s.Name = serviceName;
s.AddDeployment(d =>
{
d.Slot = DeploymentSlot.Production;
d.Name = "mydeployment";
});
});
subscription = new AzureSubscription
{
Properties = new Dictionary <AzureSubscription.Property, string> {
{ AzureSubscription.Property.Default, "True" }
},
Id = Guid.NewGuid(),
Name = Test.Utilities.Common.Data.Subscription1,
};
cloudBlobUtilityMock = new Mock <CloudBlobUtility>();
cloudBlobUtilityMock.Setup(f => f.UploadPackageToBlob(
It.IsAny <StorageManagementClient>(),
It.IsAny <string>(),
It.IsAny <string>(),
It.IsAny <BlobRequestOptions>())).Returns(new Uri("http://www.packageurl.azure.com"));
clientMocks = new ClientMocks(subscription.Id);
services.InitializeMocks(clientMocks.ComputeManagementClientMock);
storageService.InitializeMocks(clientMocks.StorageManagementClientMock);
client = new CloudServiceClient(subscription,
clientMocks.ManagementClientMock.Object,
clientMocks.StorageManagementClientMock.Object,
clientMocks.ComputeManagementClientMock.Object
)
{
CloudBlobUtility = cloudBlobUtilityMock.Object
};
}