Exemplo n.º 1
0
        protected void ValidateCloudService(CloudService cloudService, CloudService cloudServiceOut, string rgName, string csName)
        {
            Assert.Equal(cloudServiceOut.Type, string.Format("{0}/{1}", ApiConstants.ResourceProviderNamespace, ApiConstants.CloudServices));
            Assert.Equal(Helpers.GetCloudServiceReferenceId(m_subId, rgName, csName), cloudServiceOut.Id, StringComparer.OrdinalIgnoreCase);
            Assert.NotNull(cloudServiceOut.Properties);
            Assert.True(!string.IsNullOrEmpty(cloudServiceOut.Properties.ProvisioningState));
            Assert.Null(cloudServiceOut.Properties.PackageUrl);
            Assert.NotNull(cloudServiceOut.Properties.Configuration);
            Assert.NotNull(cloudServiceOut.Properties.UpgradeMode);

            if (cloudService.Properties.ExtensionProfile != null &&
                cloudService.Properties.ExtensionProfile.Extensions.Any())
            {
                foreach (var vmExtension in cloudService.Properties.ExtensionProfile.Extensions)
                {
                    var vmExt = cloudServiceOut.Properties.ExtensionProfile.Extensions.FirstOrDefault(s => String.Compare(s.Name, vmExtension.Name, StringComparison.OrdinalIgnoreCase) == 0);
                    Assert.NotNull(vmExt);
                }
            }

            if (cloudService.Properties.NetworkProfile != null)
            {
                ValidateCloudServiceNetworkProfile(cloudService.Properties.NetworkProfile, cloudServiceOut.Properties.NetworkProfile);
            }
            else
            {
                Assert.True((cloudServiceOut.Properties.NetworkProfile == null));
            }

            if (cloudService.Properties.RoleProfile != null)
            {
                ValidateCloudServiceRoleProfile(cloudService.Properties.RoleProfile, cloudServiceOut.Properties.RoleProfile);
            }
            else
            {
                Assert.True((cloudServiceOut.Properties.RoleProfile == null));
            }
        }