public void Create_container_and_enshure_it() { swiftConnectionData = KeystoneData.GetKeystoneToken(); tokenSource = new CancellationTokenSource(); swiftclient = new Swift(swiftConnectionData.Item1, swiftConnectionData.Item2, KeystoneData.keystoneTenant); ContainerCollection containerCollection = null; string containerName = Guid.NewGuid().ToString(); Assert.DoesNotThrow(() => { var tsk = swiftclient.CreateContainer(containerName, tokenSource.Token); containerCollection = tsk.Result; }); Assert.NotNull(containerCollection); Assert.True(containerCollection.Any(c => c.Name.Equals(containerName))); }
public void Delete_existing_container() { swiftConnectionData = KeystoneData.GetKeystoneToken(); tokenSource = new CancellationTokenSource(); swiftclient = new Swift(swiftConnectionData.Item1, swiftConnectionData.Item2, KeystoneData.keystoneTenant); ContainerCollection containerCollection = null; string containerName = Guid.NewGuid().ToString(); // // Create container Assert.DoesNotThrow(() => { var tsk = swiftclient.CreateContainer(containerName, tokenSource.Token); containerCollection = tsk.Result; }); Assert.NotNull(containerCollection); Assert.True(containerCollection.Any(c => c.Name.Equals(containerName))); ContainerCollection containerCollection2 = null; Container container = containerCollection.First(c => c.Name.Equals(containerName)); // // Delete this container Assert.DoesNotThrow(() => { var tsk1 = swiftclient.DeleteContainer(container, tokenSource.Token); containerCollection2 = tsk1.Result; }); // // Is not exist in new list Assert.False(containerCollection2.Any(c => c.Name.Equals(containerName))); }