Inheritance: Microsoft.WindowsAzure.Commands.Utilities.Common.AzureSMCmdlet
 public GetAzureSBNamespaceTests()
 {
     new FileSystemHelper(this).CreateAzureSdkDirectoryAndImportPublishSettings();
     client = new Mock<ServiceBusClientExtensions>();
     mockCommandRuntime = new MockCommandRuntime();
     cmdlet = new GetAzureSBNamespaceCommand()
     {
         CommandRuntime = mockCommandRuntime,
         Client = client.Object
     };
     AzureSession.AuthenticationFactory = new MockTokenAuthenticationFactory();
 }
        public void GetAzureSBNamespaceWithInvalidNamesFail()
        {
            // Setup
            string[] invalidNames = { "1test", "test#", "test invaid", "-test", "_test" };
            Mock<ServiceBusClientExtensions> client = new Mock<ServiceBusClientExtensions>();

            foreach (string invalidName in invalidNames)
            {
                MockCommandRuntime mockCommandRuntime = new MockCommandRuntime();
                GetAzureSBNamespaceCommand cmdlet = new GetAzureSBNamespaceCommand()
                {
                    Name = invalidName,
                    CommandRuntime = mockCommandRuntime,
                    Client = client.Object
                };
                string expected = string.Format("{0}\r\nParameter name: Name", string.Format(Resources.InvalidNamespaceName, invalidName));
                client.Setup(f => f.GetNamespace(invalidName)).Throws(new InvalidOperationException(expected));

                Testing.AssertThrows<InvalidOperationException>(() => cmdlet.ExecuteCmdlet(), expected);
            }
        }