public void should_keep_count_of_each_container_and_object() { IContainer container = null; var originalContainerCount = account.ContainerCount; try { container = account.CreateContainer(Constants.CONTAINER_NAME); container.AddObject(Constants.StorageItemName); container.AddObject(Constants.HeadStorageItemName); Assert.That(container.ObjectExists(Constants.StorageItemName), Is.True); Assert.That(account.ContainerCount, Is.EqualTo(originalContainerCount + 1)); Assert.That(container.ObjectCount, Is.EqualTo(2)); } finally { if (container != null && account.ContainerExists(Constants.CONTAINER_NAME)) { container.DeleteObject(Constants.StorageItemName); container.DeleteObject(Constants.HeadStorageItemName); Assert.That(container.ObjectCount, Is.EqualTo(0)); Assert.That(container.ObjectExists(Constants.StorageItemName), Is.False); Assert.That(container.ObjectExists(Constants.HeadStorageItemName), Is.False); account.DeleteContainer(Constants.CONTAINER_NAME); } Assert.That(account.ContainerExists(Constants.CONTAINER_NAME), Is.False); Assert.That(account.ContainerCount, Is.EqualTo(originalContainerCount)); } }
public void should_throw_container_not_empty_exception_if_the_container_not_empty() { IContainer container = null; try { container = account.CreateContainer(Constants.CONTAINER_NAME); container.AddObject(Constants.StorageItemName); Assert.That(container.ObjectExists(Constants.StorageItemName), Is.True); account.DeleteContainer(Constants.CONTAINER_NAME); } finally { if (container != null && account.ContainerExists(Constants.CONTAINER_NAME)) { container.DeleteObject(Constants.StorageItemName); Assert.That(container.ObjectExists(Constants.StorageItemName), Is.False); account.DeleteContainer(Constants.CONTAINER_NAME); } Assert.That(account.ContainerExists(Constants.CONTAINER_NAME), Is.False); } }