public void Should_return_No_Content_status() { Assert.Ignore("Is returning OK instead of NoContent, need to investigate - 7/14/2010"); var request = new GetContainers(storageUrl); var response = new GenerateRequestByType( new RequestFactoryWithAgentSupport("NASTTestUserAgent")).Submit(request, authToken); Assert.That(response.Status, Is.EqualTo(HttpStatusCode.NoContent)); if(response.ContentBody != null) Assert.That(response.ContentBody.Count, Is.EqualTo(0)); response.Dispose(); }
public void Should_return_the_list_of_containers() { using (new TestHelper(authToken, storageUrl)) { ICloudFilesResponse response = null; try { GetContainers request = new GetContainers(storageUrl); response = new GenerateRequestByType().Submit(request, authToken); Assert.That(response.ContentBody.Count, Is.GreaterThan(0)); } finally { if (response != null) response.Dispose(); } } }
public void Should_return_OK_status() { using(new TestHelper(authToken, storageUrl)) { ICloudFilesResponse response = null; try { GetContainers request = new GetContainers(storageUrl); response = new GenerateRequestByType(new RequestFactoryWithAgentSupport("NASTTestUserAgent")).Submit(request, authToken); Assert.That(response.Status, Is.EqualTo(HttpStatusCode.OK)); Assert.That(response.ContentBody, Is.Not.Null); } finally { if(response != null) response.Dispose(); } } }
public void Should_return_OK_status() { using(new TestHelper(authToken, storageUrl)) { CloudFilesResponseWithContentBody response = null; try { GetContainers request = new GetContainers(storageUrl, authToken); request.UserAgent = "NASTTestUserAgent"; response = new ResponseFactoryWithContentBody<CloudFilesResponseWithContentBody>().Create(new CloudFilesRequest(request)); Assert.That(response.Status, Is.EqualTo(HttpStatusCode.OK)); Assert.That(response.ContentBody, Is.Not.Null); } finally { if(response != null) response.Dispose(); } } }
public void Should_return_the_list_of_containers() { // Console.WriteLine("Begin listing containers"); using (new TestHelper(authToken, storageUrl)) { IResponseWithContentBody response = null; try { GetContainers request = new GetContainers(storageUrl, authToken); response = new ResponseFactoryWithContentBody<CloudFilesResponseWithContentBody>().Create(new CloudFilesRequest(request)); Assert.That(response.ContentBody.Count, Is.GreaterThan(0)); // foreach (string s in response.ContentBody) // Console.WriteLine(s); // Console.WriteLine("End of listing containers"); } finally { if (response != null) response.Dispose(); } } }
List<string> buildcontainerlist() { IList<string> containerList = new List<string>(); var getContainers = new GetContainers(StorageUrl); var getContainersResponse = _requestfactory.Submit(getContainers, AuthToken, _usercreds.ProxyCredentials); if (getContainersResponse.Status == HttpStatusCode.OK) { containerList = getContainersResponse.ContentBody; } return containerList.ToList(); }
public void setup() { getContainers = new GetContainers("http://storageurl"); }
/// <summary> /// This method retrieves a list of containers associated with a given account /// </summary> /// <example> /// <code> /// UserCredentials userCredentials = new UserCredentials("username", "api key"); /// IConnection connection = new Connection(userCredentials); /// List{string} containers = connection.GetContainers(); /// </code> /// </example> /// <returns>An instance of List, containing the names of the containers this account owns</returns> public List<string> GetContainers() { Log.Info(this, "Getting containers for user " + UserCredentials.Username); try { List<string> containerList = null; var getContainers = new GetContainers(StorageUrl, AuthToken); var getContainersResponse = new ResponseFactoryWithContentBody<CloudFilesResponseWithContentBody>().Create(new CloudFilesRequest(getContainers, UserCredentials.ProxyCredentials)); if (getContainersResponse.Status == HttpStatusCode.OK) { containerList = getContainersResponse.ContentBody; } return containerList; } catch(Exception ex) { Log.Error(this, "Error getting containers for user " + UserCredentials.Username, ex); throw; } }
public void Should_return_No_Content_status() { //Assert.Ignore("Is returning OK instead of NoContent, need to investigate - 2/3/2009"); GetContainers request = new GetContainers(storageUrl, authToken); request.UserAgent = "NASTTestUserAgent"; var response = new ResponseFactoryWithContentBody<CloudFilesResponseWithContentBody>().Create(new CloudFilesRequest(request)); Assert.That(response.Status, Is.EqualTo(HttpStatusCode.NoContent)); if(response.ContentBody != null) Assert.That(response.ContentBody.Count, Is.EqualTo(0)); response.Dispose(); }