public void GetAzureSBNamespaceSuccessfull() { // Setup string name = "test"; cmdlet.Name = name; ServiceBusNamespace expected = new ServiceBusNamespace { Name = name }; channel.GetNamespaceThunk = gn => { return expected; }; // Test cmdlet.ExecuteCmdlet(); // Assert ServiceBusNamespace actual = mockCommandRuntime.OutputPipeline[0] as ServiceBusNamespace; Assert.AreEqual<string>(expected.Name, actual.Name); }
public void NewAzureSBNamespaceSuccessfull() { // Setup SimpleServiceBusManagement channel = new SimpleServiceBusManagement(); MockCommandRuntime mockCommandRuntime = new MockCommandRuntime(); string name = "test"; string location = "West US"; NewAzureSBNamespaceCommand cmdlet = new NewAzureSBNamespaceCommand(channel) { Name = name, Location = location, CommandRuntime = mockCommandRuntime }; ServiceBusNamespace expected = new ServiceBusNamespace { Name = name, Region = location }; channel.CreateServiceBusNamespaceThunk = csbn => { return expected; }; channel.ListServiceBusRegionsThunk = lsbr => { List<ServiceBusRegion> list = new List<ServiceBusRegion>(); list.Add(new ServiceBusRegion { Code = location }); return list; }; // Test cmdlet.ExecuteCmdlet(); // Assert ServiceBusNamespace actual = mockCommandRuntime.OutputPipeline[0] as ServiceBusNamespace; Assert.AreEqual<ServiceBusNamespace>(expected, actual); }
public IAsyncResult BeginCreateServiceBusNamespace(string subscriptionId, ServiceBusNamespace namespaceDescription, string name, AsyncCallback callback, object state) { SimpleServiceManagementAsyncResult result = new SimpleServiceManagementAsyncResult(); result.Values["subscriptionId"] = subscriptionId; result.Values["namespaceDescription"] = namespaceDescription; result.Values["name"] = name; result.Values["callback"] = callback; result.Values["state"] = state; return result; }
public ServiceBusNamespace EndGetServiceBusNamespace(IAsyncResult asyncResult) { ServiceBusNamespace serviceBusNamespace = new ServiceBusNamespace(); if (GetNamespaceThunk != null) { SimpleServiceManagementAsyncResult result = asyncResult as SimpleServiceManagementAsyncResult; Assert.IsNotNull(result, "asyncResult was not SimpleServiceManagementAsyncResult!"); serviceBusNamespace = GetNamespaceThunk(result); } else if (ThrowsIfNotImplemented) { throw new NotImplementedException("GetNamespaceThunk is not implemented!"); } return serviceBusNamespace; }
public static ServiceBusNamespace CreateServiceBusNamespace(this IServiceBusManagement proxy, string subscriptionId, ServiceBusNamespace namespaceDescription, string name) { return proxy.EndCreateServiceBusNamespace(proxy.BeginCreateServiceBusNamespace(subscriptionId, namespaceDescription, name, null, null)); }