Exemple #1
0
        public void CrudProfileWithoutEndpoints_ThenUpdate()
        {
            using (MockContext context = MockContext.Start(this.GetType().FullName))
            {
                TrafficManagerManagementClient trafficManagerClient = this.GetTrafficManagerManagementClient(context);

                string        resourceGroupName = TrafficManagerHelper.GenerateName();
                string        profileName       = TrafficManagerHelper.GenerateName();
                ResourceGroup resourceGroup     = this.CreateResourceGroup(context, resourceGroupName);

                // Create the profile
                Profile profile = TrafficManagerHelper.CreateOrUpdateDefaultEmptyProfile(
                    trafficManagerClient,
                    resourceGroupName,
                    profileName);

                Assert.Equal(0, profile.Endpoints.Count);

                // Create the endpoint and associate it with the resource group and profile.
                TrafficManagerHelper.CreateOrUpdateDefaultEndpoint(trafficManagerClient, resourceGroupName, profileName);

                // Confirm the endpoint is associated with the profile.
                Profile updatedProfile = trafficManagerClient.Profiles.Get(
                    resourceGroup.Name,
                    profileName);

                Assert.Equal(1, updatedProfile.Endpoints.Count);

                // Delete the profile. The associated endpoint will also be deleted.
                trafficManagerClient.Profiles.DeleteWithHttpMessagesAsync(resourceGroup.Name, profileName);
                this.DeleteResourceGroup(context, resourceGroupName);
            }
        }