Exemplo n.º 1
0
        private List <string> CreateNotificationHubs(string location, string resourceGroup, string namespaceName, int count)
        {
            List <string> notificationHubNameList = new List <string>();

            for (int i = 0; i < count; i++)
            {
                var notificationHubName = TestUtilities.GenerateName(NotificationHubsManagementHelper.NotificationHubPrefix) + TestUtilities.GenerateName();
                notificationHubNameList.Add(notificationHubName);
                Console.WriteLine(notificationHubName);


                var parameter = new NotificationHubCreateOrUpdateParameters()
                {
                    Location   = location,
                    Properties = new NotificationHubProperties()
                };

                var jsonStr = NotificationHubsManagementHelper.ConvertObjectToJSon(parameter);

                var createNotificationHubResponse = NotificationHubsManagementClient.NotificationHubs.Create(resourceGroup, namespaceName,
                                                                                                             notificationHubName, parameter);
                Assert.NotNull(createNotificationHubResponse);
                Assert.NotNull(createNotificationHubResponse.Value);
            }

            return(notificationHubNameList);
        }
        public NotificationHubAttributes CreateNotificationHub(string resourceGroupName, string namespaceName, NotificationHubAttributes nhAttributes)
        {
            var parameter = new NotificationHubCreateOrUpdateParameters()
            {
                Location   = nhAttributes.Location,
                Properties = new NotificationHubProperties()
                {
                    AdmCredential   = nhAttributes.AdmCredential,
                    ApnsCredential  = nhAttributes.ApnsCredential,
                    BaiduCredential = nhAttributes.BaiduCredential,
                    GcmCredential   = nhAttributes.GcmCredential,
                    MpnsCredential  = nhAttributes.MpnsCredential,
                    WnsCredential   = nhAttributes.WnsCredential,
                    Name            = nhAttributes.Name,
                    RegistrationTtl = nhAttributes.RegistrationTtl
                }
            };

            if (nhAttributes.Tags != null)
            {
                parameter.Tags = new Dictionary <string, string>(nhAttributes.Tags);
            }
            var response = Client.NotificationHubs.Create(resourceGroupName, namespaceName, nhAttributes.Name, parameter);

            return(new NotificationHubAttributes(response.Value));
        }
        private List <string> CreateNotificationHubs(string location, string resourceGroup, string namespaceName, int count)
        {
            List <string> notificationHubNameList = new List <string>();

            for (int i = 0; i < count; i++)
            {
                var notificationHubName = TestUtilities.GenerateName(NotificationHubsManagementHelper.NotificationHubPrefix) + TestUtilities.GenerateName();
                notificationHubNameList.Add(notificationHubName);
                Console.WriteLine(notificationHubName);


                var parameter = new NotificationHubCreateOrUpdateParameters()
                {
                    Location   = location,
                    Properties = new NotificationHubProperties()
                    {
                        WnsCredential = new WnsCredential()
                        {
                            Properties = new WnsCredentialProperties()
                            {
                                PackageSid          = "ms-app://s-1-15-2-1817505189-427745171-3213743798-2985869298-800724128-1004923984-4143860699",
                                SecretKey           = "w7TBprR-9tJxn9mUOdK4PPHLCAzSYFhp",
                                WindowsLiveEndpoint = @"http://pushtestservice.cloudapp.net/LiveID/accesstoken.srf"
                            }
                        }
                    }
                };

                var jsonStr = NotificationHubsManagementHelper.ConvertObjectToJSon(parameter);

                var createNotificationHubResponse = NotificationHubsManagementClient.NotificationHubs.CreateOrUpdate(resourceGroup, namespaceName,
                                                                                                                     notificationHubName, parameter);
                Assert.NotNull(createNotificationHubResponse);
            }

            return(notificationHubNameList);
        }
 /// <summary>
 /// Creates/Update a NotificationHub in a namespace.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group.
 /// </param>
 /// <param name='namespaceName'>
 /// The namespace name.
 /// </param>
 /// <param name='notificationHubName'>
 /// The notification hub name.
 /// </param>
 /// <param name='parameters'>
 /// Parameters supplied to the create/update a NotificationHub Resource.
 /// </param>
 public static NotificationHubResource CreateOrUpdate(this INotificationHubsOperations operations, string resourceGroupName, string namespaceName, string notificationHubName, NotificationHubCreateOrUpdateParameters parameters)
 {
     return(operations.CreateOrUpdateAsync(resourceGroupName, namespaceName, notificationHubName, parameters).GetAwaiter().GetResult());
 }
 /// <summary>
 /// Creates/Update a NotificationHub in a namespace.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group.
 /// </param>
 /// <param name='namespaceName'>
 /// The namespace name.
 /// </param>
 /// <param name='notificationHubName'>
 /// The notification hub name.
 /// </param>
 /// <param name='parameters'>
 /// Parameters supplied to the create/update a NotificationHub Resource.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <NotificationHubResource> CreateOrUpdateAsync(this INotificationHubsOperations operations, string resourceGroupName, string namespaceName, string notificationHubName, NotificationHubCreateOrUpdateParameters parameters, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, namespaceName, notificationHubName, parameters, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Exemplo n.º 6
0
        public void NotificationHubCreateGetUpdateDelete()
        {
            using (var context = UndoContext.Current)
            {
                context.Start("ScenarioTests", "NotificationHubCreateGetUpdateDelete");

                var location      = NotificationHubsManagementHelper.DefaultLocation;
                var resourceGroup = this.ResourceManagementClient.TryGetResourceGroup(location);
                if (string.IsNullOrWhiteSpace(resourceGroup))
                {
                    resourceGroup = TestUtilities.GenerateName(NotificationHubsManagementHelper.ResourceGroupPrefix);
                    this.ResourceManagementClient.TryRegisterResourceGroup(location, resourceGroup);
                }

                var namespaceName = TestUtilities.GenerateName(NotificationHubsManagementHelper.NamespacePrefix);

                var createNamespaceResponse = NotificationHubsManagementClient.Namespaces.CreateOrUpdate(resourceGroup, namespaceName,
                                                                                                         new NamespaceCreateOrUpdateParameters()
                {
                    Location   = location,
                    Properties = new NamespaceProperties()
                    {
                        NamespaceType = NamespaceType.NotificationHub
                    }
                });

                Assert.NotNull(createNamespaceResponse);
                Assert.NotNull(createNamespaceResponse.Value);
                Assert.Equal(createNamespaceResponse.Value.Properties.Name, namespaceName);

                TestUtilities.Wait(TimeSpan.FromSeconds(30));

                //Get the created namespace
                var getNamespaceResponse = NotificationHubsManagementClient.Namespaces.Get(resourceGroup, namespaceName);
                Assert.NotNull(getNamespaceResponse);
                Assert.NotNull(getNamespaceResponse.Value);
                if (string.Compare(getNamespaceResponse.Value.Properties.ProvisioningState, "Succeeded", true) != 0)
                {
                    TestUtilities.Wait(TimeSpan.FromSeconds(5));
                }

                Assert.Equal("Succeeded", getNamespaceResponse.Value.Properties.ProvisioningState, StringComparer.CurrentCultureIgnoreCase);
                Assert.Equal("Active", getNamespaceResponse.Value.Properties.Status, StringComparer.CurrentCultureIgnoreCase);

                //Create a notificationHub
                var notificationHubList = CreateNotificationHubs(location, resourceGroup, namespaceName, 1);
                var notificationHubName = notificationHubList.FirstOrDefault();

                //Get the created notificationHub
                var getNotificationHubResponse = NotificationHubsManagementClient.NotificationHubs.Get(resourceGroup, namespaceName, notificationHubName);
                Assert.NotNull(getNotificationHubResponse);
                Assert.NotNull(getNotificationHubResponse.Value);
                Assert.Equal(getNotificationHubResponse.Value.Name, notificationHubName);

                //Get all namespaces created within a namespace
                var getAllNotificationHubsResponse = NotificationHubsManagementClient.NotificationHubs.List(resourceGroup, namespaceName);
                Assert.NotNull(getAllNotificationHubsResponse);
                Assert.NotNull(getAllNotificationHubsResponse.Value);
                Assert.True(getAllNotificationHubsResponse.Value.Count >= 1);
                Assert.True(getAllNotificationHubsResponse.Value.Any(nh => string.Compare(nh.Name, notificationHubName, true) == 0));
                Assert.True(getAllNotificationHubsResponse.Value.All(nh => nh.Id.Contains(resourceGroup)));

                //Update notificationHub tags and add PNS credentials
                var updateNotificationHubParameter = new NotificationHubCreateOrUpdateParameters()
                {
                    Location   = location,
                    Properties = new NotificationHubProperties()
                    {
                        WnsCredential = new WnsCredential()
                        {
                            Properties = new WnsCredentialProperties()
                            {
                                PackageSid          = "ms-app://s-1-15-2-1817505189-427745171-3213743798-2985869298-800724128-1004923984-4143860699",
                                SecretKey           = "w7TBprR-9tJxn9mUOdK4PPHLCAzSYFhp",
                                WindowsLiveEndpoint = @"http://pushtestservice.cloudapp.net/LiveID/accesstoken.srf"
                            }
                        }
                    }
                };
                updateNotificationHubParameter.Tags.Add(new KeyValuePair <string, string>("tag1", "value1"));
                updateNotificationHubParameter.Tags.Add(new KeyValuePair <string, string>("tag2", "value2"));
                updateNotificationHubParameter.Tags.Add(new KeyValuePair <string, string>("tag3", "value3"));

                var jsonStr = NotificationHubsManagementHelper.ConvertObjectToJSon(updateNotificationHubParameter);

                var updateNotificationHubResponse = NotificationHubsManagementClient.NotificationHubs.Update(resourceGroup, namespaceName,
                                                                                                             notificationHubName, updateNotificationHubParameter);

                Assert.NotNull(updateNotificationHubResponse);
                Assert.NotNull(updateNotificationHubResponse.Value);

                TestUtilities.Wait(TimeSpan.FromSeconds(30));

                //Get the updated notificationHub
                getNotificationHubResponse = NotificationHubsManagementClient.NotificationHubs.Get(resourceGroup, namespaceName, notificationHubName);
                Assert.NotNull(getNotificationHubResponse);
                Assert.NotNull(getNotificationHubResponse.Value);
                Assert.Equal(getNotificationHubResponse.Value.Tags.Count, 3);
                foreach (var tag in updateNotificationHubParameter.Tags)
                {
                    Assert.True(getNotificationHubResponse.Value.Tags.Any(t => t.Key.Equals(tag.Key)));
                    Assert.True(getNotificationHubResponse.Value.Tags.Any(t => t.Value.Equals(tag.Value)));
                }

                //Get the updated notificationHub PNSCredentials
                var getNotificationHubPnsCredentialsResponse = NotificationHubsManagementClient.NotificationHubs.GetPnsCredentials(resourceGroup, namespaceName, notificationHubName);
                Assert.NotNull(getNotificationHubPnsCredentialsResponse);
                Assert.NotNull(getNotificationHubPnsCredentialsResponse.Value);
                Assert.Equal(notificationHubName, getNotificationHubPnsCredentialsResponse.Value.Name);
                Assert.NotNull(getNotificationHubPnsCredentialsResponse.Value.Properties);
                Assert.NotNull(getNotificationHubPnsCredentialsResponse.Value.Properties.WnsCredential);
                Assert.Equal(getNotificationHubPnsCredentialsResponse.Value.Properties.WnsCredential.Properties.PackageSid, updateNotificationHubParameter.Properties.WnsCredential.Properties.PackageSid);
                Assert.Equal(getNotificationHubPnsCredentialsResponse.Value.Properties.WnsCredential.Properties.SecretKey, updateNotificationHubParameter.Properties.WnsCredential.Properties.SecretKey);
                Assert.Equal(getNotificationHubPnsCredentialsResponse.Value.Properties.WnsCredential.Properties.WindowsLiveEndpoint, updateNotificationHubParameter.Properties.WnsCredential.Properties.WindowsLiveEndpoint);


                //Delete notificationHub
                var deleteResponse = NotificationHubsManagementClient.NotificationHubs.Delete(resourceGroup, namespaceName, notificationHubName);
                Assert.NotNull(deleteResponse);
                Assert.Equal(deleteResponse.StatusCode, HttpStatusCode.OK);
                TestUtilities.Wait(TimeSpan.FromSeconds(30));

                try
                {
                    NotificationHubsManagementClient.NotificationHubs.Get(resourceGroup, namespaceName, notificationHubName);
                    Assert.True(false, "this step should have failed");
                }
                catch (CloudException ex)
                {
                    Assert.Equal(HttpStatusCode.NotFound, ex.Response.StatusCode);
                }

                //Delete namespace
                var deleteNSResponse = NotificationHubsManagementClient.Namespaces.Delete(resourceGroup, namespaceName);
                Assert.NotNull(deleteNSResponse);
                Assert.True(HttpStatusCode.NotFound == deleteNSResponse.StatusCode || HttpStatusCode.OK == deleteNSResponse.StatusCode);
            }
        }
Exemplo n.º 7
0
 /// <summary>
 /// Creates a new NotificationHub in a namespace.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/jj856303.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.NotificationHubs.INotificationHubOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The name of the resource group.
 /// </param>
 /// <param name='namespaceName'>
 /// Required. The namespace name.
 /// </param>
 /// <param name='notificationHubName'>
 /// Required. The notification hub name.
 /// </param>
 /// <param name='parameters'>
 /// Required. Parameters supplied to the create a Namespace Resource.
 /// </param>
 /// <returns>
 /// Response of the CreateOrUpdate operation on the NotificationHub
 /// </returns>
 public static Task <NotificationHubCreateOrUpdateResponse> UpdateAsync(this INotificationHubOperations operations, string resourceGroupName, string namespaceName, string notificationHubName, NotificationHubCreateOrUpdateParameters parameters)
 {
     return(operations.UpdateAsync(resourceGroupName, namespaceName, notificationHubName, parameters, CancellationToken.None));
 }
Exemplo n.º 8
0
 /// <summary>
 /// Creates a new NotificationHub in a namespace.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/jj856303.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.NotificationHubs.INotificationHubOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The name of the resource group.
 /// </param>
 /// <param name='namespaceName'>
 /// Required. The namespace name.
 /// </param>
 /// <param name='notificationHubName'>
 /// Required. The notification hub name.
 /// </param>
 /// <param name='parameters'>
 /// Required. Parameters supplied to the create a Namespace Resource.
 /// </param>
 /// <returns>
 /// Response of the CreateOrUpdate operation on the NotificationHub
 /// </returns>
 public static NotificationHubCreateOrUpdateResponse Update(this INotificationHubOperations operations, string resourceGroupName, string namespaceName, string notificationHubName, NotificationHubCreateOrUpdateParameters parameters)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((INotificationHubOperations)s).UpdateAsync(resourceGroupName, namespaceName, notificationHubName, parameters);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
Exemplo n.º 9
0
        public void NotificationHubCreateGetUpdateDelete()
        {
            using (MockContext context = MockContext.Start(this.GetType().FullName))
            {
                InitializeClients(context);

                var location      = NotificationHubsManagementHelper.DefaultLocation;
                var resourceGroup = this.ResourceManagementClient.TryGetResourceGroup(location);
                if (string.IsNullOrWhiteSpace(resourceGroup))
                {
                    resourceGroup = TestUtilities.GenerateName(NotificationHubsManagementHelper.ResourceGroupPrefix);
                    this.ResourceManagementClient.TryRegisterResourceGroup(location, resourceGroup);
                }

                var namespaceName = TestUtilities.GenerateName(NotificationHubsManagementHelper.NamespacePrefix);

                var createNamespaceResponse = NotificationHubsManagementClient.Namespaces.CreateOrUpdate(resourceGroup, namespaceName,
                                                                                                         new NamespaceCreateOrUpdateParameters()
                {
                    Location = location
                });

                Assert.NotNull(createNamespaceResponse);
                Assert.Equal(createNamespaceResponse.Name, namespaceName);

                ActivateNamespace(resourceGroup, namespaceName);

                //Get the created namespace
                var getNamespaceResponse = NotificationHubsManagementClient.Namespaces.Get(resourceGroup, namespaceName);
                Assert.NotNull(getNamespaceResponse);

                Assert.Equal("Succeeded", getNamespaceResponse.ProvisioningState, StringComparer.CurrentCultureIgnoreCase);
                Assert.Equal("Active", getNamespaceResponse.Status, StringComparer.CurrentCultureIgnoreCase);

                var createParameter = new NotificationHubCreateOrUpdateParameters()
                {
                    Location      = location,
                    WnsCredential = new WnsCredential()
                    {
                        PackageSid          = "ms-app://s-1-15-2-1817505189-427745171-3213743798-2985869298-800724128-1004923984-4143860699",
                        SecretKey           = "w7TBprR-9tJxn9mUOdK4PPHLCAzSYFhp",
                        WindowsLiveEndpoint = @"http://pushtestservice.cloudapp.net/LiveID/accesstoken.srf"
                    },
                    ApnsCredential = new ApnsCredential()
                    {
                        KeyId    = "TXRXD9P6K7",
                        AppId    = "EF9WEB9D5K",
                        AppName  = "Sample",
                        Token    = "MIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgpVB15km4qskA5Ra5XvdtOwWPvaXIhVVQZdonzINh+hGgCgYIKoZIzj0DAQehRANCAASS3ek04J20BqA6WWDlD6+xd3dJEifhW87wI0nnkfUB8LDb424TiWlzGIgnxV79hb3QHCAUNsPdBfLLF+Od8yqL",
                        Endpoint = "https://api.push.apple.com:443/3/device"
                    }
                };


                //Create a notificationHub
                var notificationHubList = CreateNotificationHubs(location, resourceGroup, namespaceName, 1, createParameter);
                var notificationHubName = notificationHubList.FirstOrDefault();

                //Get the created notificationHub
                var getNotificationHubResponse = NotificationHubsManagementClient.NotificationHubs.Get(resourceGroup, namespaceName, notificationHubName);
                Assert.NotNull(getNotificationHubResponse);
                Assert.Equal(getNotificationHubResponse.Name, notificationHubName);

                //Get all namespaces created within a namespace
                var getAllNotificationHubsResponse = NotificationHubsManagementClient.NotificationHubs.List(resourceGroup, namespaceName);
                Assert.NotNull(getAllNotificationHubsResponse);
                Assert.True(getAllNotificationHubsResponse.Count() >= 1);
                Assert.Contains(getAllNotificationHubsResponse, nh => string.Compare(nh.Name, notificationHubName, true) == 0);
                Assert.True(getAllNotificationHubsResponse.All(nh => nh.Id.Contains(resourceGroup)));

                var getNotificationHubPnsCredentialsResponse = NotificationHubsManagementClient.NotificationHubs.GetPnsCredentials(resourceGroup, namespaceName, notificationHubName);
                Assert.NotNull(getNotificationHubPnsCredentialsResponse);
                Assert.NotNull(getNotificationHubPnsCredentialsResponse);
                Assert.Equal(notificationHubName, getNotificationHubPnsCredentialsResponse.Name);
                Assert.NotNull(getNotificationHubPnsCredentialsResponse.WnsCredential);
                Assert.Equal(getNotificationHubPnsCredentialsResponse.WnsCredential.PackageSid, createParameter.WnsCredential.PackageSid);
                Assert.Equal(getNotificationHubPnsCredentialsResponse.WnsCredential.SecretKey, createParameter.WnsCredential.SecretKey);
                Assert.Equal(getNotificationHubPnsCredentialsResponse.WnsCredential.WindowsLiveEndpoint, createParameter.WnsCredential.WindowsLiveEndpoint);
                Assert.Equal(getNotificationHubPnsCredentialsResponse.ApnsCredential.KeyId, createParameter.ApnsCredential.KeyId);
                Assert.Equal(getNotificationHubPnsCredentialsResponse.ApnsCredential.Token, createParameter.ApnsCredential.Token);
                Assert.Equal(getNotificationHubPnsCredentialsResponse.ApnsCredential.AppId, createParameter.ApnsCredential.AppId);
                Assert.Equal(getNotificationHubPnsCredentialsResponse.ApnsCredential.AppName, createParameter.ApnsCredential.AppName);
                Assert.Equal(getNotificationHubPnsCredentialsResponse.ApnsCredential.Endpoint, createParameter.ApnsCredential.Endpoint);

                //Update notificationHub tags and add PNS credentials
                var updateNotificationHubParameter = new NotificationHubCreateOrUpdateParameters()
                {
                    Location = location,
                    Tags     = new Dictionary <string, string>()
                    {
                        { "tag1", "value1" },
                        { "tag2", "value2" },
                        { "tag3", "value3" },
                    },

                    WnsCredential = new WnsCredential()
                    {
                        PackageSid          = "ms-app://s-1-15-2-1817505189-427745171-3213743798-2985869298-800724128-1004923984-4143860699",
                        SecretKey           = "w7TBprR-9tJxn9mUOdK4PPHLCAzSYFhp",
                        WindowsLiveEndpoint = @"http://pushtestservice.cloudapp.net/LiveID/accesstoken.srf"
                    },
                    ApnsCredential = new ApnsCredential()
                    {
                        KeyId    = "TXRXD9P6K7",
                        AppId    = "EF9WEB9D5K",
                        AppName  = "Sample2",
                        Token    = "MIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgpVB15km4qskA5Ra5XvdtOwWPvaXIhVVQZdonzINh+hGgCgYIKoZIzj0DAQehRANCAASS3ek04J20BqA6WWDlD6+xd3dJEifhW87wI0nnkfUB8LDb424TiWlzGIgnxV79hb3QHCAUNsPdBfLLF+Od8yqL",
                        Endpoint = "https://api.push.apple.com:443/3/device"
                    }
                };

                var jsonStr = NotificationHubsManagementHelper.ConvertObjectToJSon(updateNotificationHubParameter);

                var updateNotificationHubResponse = NotificationHubsManagementClient.NotificationHubs.CreateOrUpdate(resourceGroup, namespaceName,
                                                                                                                     notificationHubName, updateNotificationHubParameter);

                Assert.NotNull(updateNotificationHubResponse);

                TestUtilities.Wait(TimeSpan.FromSeconds(30));

                //Get the updated notificationHub
                getNotificationHubResponse = NotificationHubsManagementClient.NotificationHubs.Get(resourceGroup, namespaceName, notificationHubName);
                Assert.NotNull(getNotificationHubResponse);
                Assert.Equal(3, getNotificationHubResponse.Tags.Count);
                foreach (var tag in updateNotificationHubParameter.Tags)
                {
                    Assert.Contains(getNotificationHubResponse.Tags, t => t.Key.Equals(tag.Key));
                    Assert.Contains(getNotificationHubResponse.Tags, t => t.Value.Equals(tag.Value));
                }

                //Get the updated notificationHub PNSCredentials
                getNotificationHubPnsCredentialsResponse = NotificationHubsManagementClient.NotificationHubs.GetPnsCredentials(resourceGroup, namespaceName, notificationHubName);
                Assert.NotNull(getNotificationHubPnsCredentialsResponse);
                Assert.Equal(notificationHubName, getNotificationHubPnsCredentialsResponse.Name);
                Assert.NotNull(getNotificationHubPnsCredentialsResponse.WnsCredential);
                Assert.Equal(getNotificationHubPnsCredentialsResponse.WnsCredential.PackageSid, updateNotificationHubParameter.WnsCredential.PackageSid);
                Assert.Equal(getNotificationHubPnsCredentialsResponse.WnsCredential.SecretKey, updateNotificationHubParameter.WnsCredential.SecretKey);
                Assert.Equal(getNotificationHubPnsCredentialsResponse.WnsCredential.WindowsLiveEndpoint, updateNotificationHubParameter.WnsCredential.WindowsLiveEndpoint);
                Assert.Equal(getNotificationHubPnsCredentialsResponse.ApnsCredential.KeyId, updateNotificationHubParameter.ApnsCredential.KeyId);
                Assert.Equal(getNotificationHubPnsCredentialsResponse.ApnsCredential.Token, updateNotificationHubParameter.ApnsCredential.Token);
                Assert.Equal(getNotificationHubPnsCredentialsResponse.ApnsCredential.AppId, updateNotificationHubParameter.ApnsCredential.AppId);
                Assert.Equal(getNotificationHubPnsCredentialsResponse.ApnsCredential.AppName, updateNotificationHubParameter.ApnsCredential.AppName);
                Assert.Equal(getNotificationHubPnsCredentialsResponse.ApnsCredential.Endpoint, updateNotificationHubParameter.ApnsCredential.Endpoint);

                //Delete notificationHub
                NotificationHubsManagementClient.NotificationHubs.Delete(resourceGroup, namespaceName, notificationHubName);
                TestUtilities.Wait(TimeSpan.FromSeconds(30));

                try
                {
                    NotificationHubsManagementClient.NotificationHubs.Get(resourceGroup, namespaceName, notificationHubName);
                    Assert.True(false, "this step should have failed");
                }
                catch (CloudException ex)
                {
                    Assert.Equal(HttpStatusCode.NotFound, ex.Response.StatusCode);
                }

                try
                {
                    //Delete namespace
                    NotificationHubsManagementClient.Namespaces.Delete(resourceGroup, namespaceName);
                }
                catch (Exception ex)
                {
                    Assert.Contains("NotFound", ex.Message);
                }
            }
        }