public void should_return_401_unauthorized()
        {
            var exceptionThrown = false;

            try
            {
                var lastGroup = storageUrl.Substring(storageUrl.LastIndexOf('-')+1);
                var badStorageUrl = storageUrl.Replace(lastGroup, new string('f', lastGroup.Length));
                var getAccountInformation = new GetAccountInformation(badStorageUrl);
                new GenerateRequestByType().Submit(getAccountInformation, authToken);
            }
            catch (WebException we)
            {
                exceptionThrown = true;
                var response = (HttpWebResponse)we.Response;
                if (response.StatusCode != HttpStatusCode.Unauthorized) Assert.Fail("Should be a 401 error");
            }

            Assert.That(exceptionThrown, Is.True);
        }
 public void should_return_number_of_containers_and_bytes_used()
 {
     try
     {
         connection.CreateContainer(Constants.CONTAINER_NAME);
         connection.PutStorageItem(Constants.CONTAINER_NAME, Constants.StorageItemName);
     }
     finally
     {
         connection.DeleteStorageItem(Constants.CONTAINER_NAME, Constants.StorageItemName);
         connection.DeleteContainer(Constants.CONTAINER_NAME);
     }
     using (var testHelper = new TestHelper(authToken, storageUrl))
     {
         testHelper.PutItemInContainer(Constants.StorageItemName, Constants.StorageItemName);
         var getAccountInformation = new GetAccountInformation(storageUrl);
         var response =new GenerateRequestByType().Submit(getAccountInformation, authToken);
         Assert.That(response.Headers[Constants.XAccountBytesUsed], Is.Not.Null);
         Assert.That(response.Headers[Constants.XAccountContainerCount], Is.Not.Null);
         testHelper.DeleteItemFromContainer(Constants.StorageItemName);
     }
 }
 public void should_return_204_no_content_when_the_account_has_no_containers()
 {
     var getAccountInformation = new GetAccountInformation(storageUrl);
     var response = new GenerateRequestByType().Submit(getAccountInformation, authToken);
     Assert.That(response.Status, Is.EqualTo(HttpStatusCode.NoContent));
 }
 public void setup()
 {
     getAccountInformation = new GetAccountInformation("http://storageurl");
     _mockrequest = new Mock<ICloudFilesRequest>();
 }
 private AccountInformation BuildAccount()
 {
     var getAccountInformation = new GetAccountInformation(StorageUrl);
     var getAccountInformationResponse = _requestfactory.Submit(getAccountInformation, AuthToken);
     return new AccountInformation(getAccountInformationResponse.Headers[Constants.X_ACCOUNT_CONTAINER_COUNT], getAccountInformationResponse.Headers[Constants.X_ACCOUNT_BYTES_USED]);
 }