public void Should_Enable_Static_Web_On_Container_With_CSS_And_Listing_As_True() { var provider = new CloudFilesProvider(); //var cdnEnabledResponse = provider.EnableCDNOnContainer( containerName, true, identity: _testIdentity); provider.EnableStaticWebOnContainer(containerName, webListingsCSS, webListing, null, false, _testIdentity); var cdnContainerMetaDataResponse = provider.GetContainerMetaData(containerName, identity: _testIdentity); Assert.AreEqual(webListingsCSS, cdnContainerMetaDataResponse.Where(x => x.Key.Equals("web-listings-css", StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault().Value); Assert.IsTrue(bool.Parse(cdnContainerMetaDataResponse.Where(x => x.Key.Equals("web-listings", StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault().Value)); }
public void Should_Enable_Static_Web_On_Container_With_Index_And_Error() { var provider = new CloudFilesProvider(); //var cdnEnabledResponse = provider.EnableCDNOnContainer( containerName, true, identity: _testIdentity); provider.EnableStaticWebOnContainer(containerName, webIndex, webError, null, false, _testIdentity); var cdnContainerMetaDataResponse = provider.GetContainerMetaData(containerName, identity: _testIdentity); Assert.AreEqual(webIndex, cdnContainerMetaDataResponse.Where(x => x.Key.Equals("Web-index", StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault().Value); Assert.AreEqual(webError, cdnContainerMetaDataResponse.Where(x => x.Key.Equals("web-error", StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault().Value); }
public void TestStaticWebOnContainer() { IObjectStorageProvider provider = new CloudFilesProvider(Bootstrapper.Settings.TestIdentity); string containerName = TestContainerPrefix + Path.GetRandomFileName(); string objectName = Path.GetRandomFileName(); string fileContents = "File contents!"; ObjectStore result = provider.CreateContainer(containerName); Assert.AreEqual(ObjectStore.ContainerCreated, result); Stream stream = new MemoryStream(Encoding.UTF8.GetBytes(fileContents)); provider.CreateObject(containerName, stream, objectName); Dictionary<string, string> cdnHeaders = provider.EnableCDNOnContainer(containerName, false); Assert.IsNotNull(cdnHeaders); Console.WriteLine("CDN Headers"); foreach (var pair in cdnHeaders) Console.WriteLine(" {0}: {1}", pair.Key, pair.Value); string index = objectName; string error = objectName; string css = objectName; provider.EnableStaticWebOnContainer(containerName, index: index, error: error, listing: false); provider.DisableStaticWebOnContainer(containerName); provider.DeleteContainer(containerName, deleteObjects: true); }