public void Should_Get_Headers_For_Container() { var provider = new CloudFilesProvider(); var objectHeadersResponse = provider.GetContainerHeader(containerName, identity: _testIdentity); Assert.IsNotNull(objectHeadersResponse); //Assert.AreEqual("Christian Bale", objectHeadersResponse.Where(x => x.Key.Equals("X-Object-Meta-Actor", StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault().Value); }
public void TestVersionedContainer() { IObjectStorageProvider provider = new CloudFilesProvider(Bootstrapper.Settings.TestIdentity); string containerName = TestContainerPrefix + Path.GetRandomFileName(); string versionsContainerName = TestContainerPrefix + Path.GetRandomFileName(); ObjectStore result = provider.CreateContainer(versionsContainerName); Assert.AreEqual(ObjectStore.ContainerCreated, result); result = provider.CreateContainer(containerName, new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { { CloudFilesProvider.VersionsLocation, versionsContainerName } }); Assert.AreEqual(ObjectStore.ContainerCreated, result); Dictionary<string, string> headers = provider.GetContainerHeader(containerName); string location; Assert.IsTrue(headers.TryGetValue(CloudFilesProvider.VersionsLocation, out location)); Assert.AreEqual(versionsContainerName, location); string objectName = Path.GetRandomFileName(); string fileData1 = "first-content"; string fileData2 = "second-content"; /* * Create the object */ using (MemoryStream uploadStream = new MemoryStream(Encoding.UTF8.GetBytes(fileData1))) { provider.CreateObject(containerName, uploadStream, objectName); } string actualData = ReadAllObjectText(provider, containerName, objectName, Encoding.UTF8); Assert.AreEqual(fileData1, actualData); /* * Overwrite the object */ using (MemoryStream uploadStream = new MemoryStream(Encoding.UTF8.GetBytes(fileData2))) { provider.CreateObject(containerName, uploadStream, objectName); } actualData = ReadAllObjectText(provider, containerName, objectName, Encoding.UTF8); Assert.AreEqual(fileData2, actualData); /* * Delete the object once */ provider.DeleteObject(containerName, objectName); actualData = ReadAllObjectText(provider, containerName, objectName, Encoding.UTF8); Assert.AreEqual(fileData1, actualData); /* * Cleanup */ provider.DeleteContainer(versionsContainerName, deleteObjects: true); provider.DeleteContainer(containerName, deleteObjects: true); }
public void TestGetContainerHeader() { IObjectStorageProvider provider = new CloudFilesProvider(Bootstrapper.Settings.TestIdentity); string containerName = TestContainerPrefix + Path.GetRandomFileName(); ObjectStore result = provider.CreateContainer(containerName); Assert.AreEqual(ObjectStore.ContainerCreated, result); Dictionary<string, string> headers = provider.GetContainerHeader(containerName); Console.WriteLine("Container Headers"); foreach (KeyValuePair<string, string> pair in headers) Console.WriteLine(" {0}: {1}", pair.Key, pair.Value); provider.DeleteContainer(containerName, deleteObjects: true); }
public void Should_Get_Headers_For_Container() { var provider = new CloudFilesProvider(); var objectHeadersResponse = provider.GetContainerHeader(containerName, identity: _testIdentity); Assert.IsNotNull(objectHeadersResponse); Assert.IsTrue(objectHeadersResponse.Any()); }