|
| 1 | +using System; |
| 2 | +using System.Configuration; |
| 3 | +using System.Text; |
| 4 | +using System.Collections.Generic; |
| 5 | +using System.Linq; |
| 6 | +using Microsoft.VisualStudio.TestTools.UnitTesting; |
| 7 | +using net.openstack.Core.Domain; |
| 8 | +using net.openstack.Providers.Rackspace; |
| 9 | + |
| 10 | +namespace Net.OpenStack.Testing.Integration.Providers.Rackspace |
| 11 | +{ |
| 12 | + [TestClass] |
| 13 | + public class ObjectStoreTests |
| 14 | + { |
| 15 | + |
| 16 | + public ObjectStoreTests() |
| 17 | + { |
| 18 | + CloudInstance cloudInstance; |
| 19 | + CloudInstance.TryParse(ConfigurationManager.AppSettings["TestIdentityGeo"], true, out cloudInstance); |
| 20 | + |
| 21 | + _testIdentity = new RackspaceCloudIdentity |
| 22 | + { |
| 23 | + APIKey = ConfigurationManager.AppSettings["TestIdentityAPIKey"], |
| 24 | + Password = ConfigurationManager.AppSettings["TestIdentityPassword"], |
| 25 | + CloudInstance = cloudInstance, |
| 26 | + Username = ConfigurationManager.AppSettings["TestIdentityUserName"], |
| 27 | + }; |
| 28 | + } |
| 29 | + |
| 30 | + private TestContext testContextInstance; |
| 31 | + private static CloudIdentity _testIdentity; |
| 32 | + |
| 33 | + /// <summary> |
| 34 | + ///Gets or sets the test context which provides |
| 35 | + ///information about and functionality for the current test run. |
| 36 | + ///</summary> |
| 37 | + public TestContext TestContext |
| 38 | + { |
| 39 | + get |
| 40 | + { |
| 41 | + return testContextInstance; |
| 42 | + } |
| 43 | + set |
| 44 | + { |
| 45 | + testContextInstance = value; |
| 46 | + } |
| 47 | + } |
| 48 | + |
| 49 | + |
| 50 | + [TestMethod] |
| 51 | + public void Should_Return_Container_List() |
| 52 | + { |
| 53 | + var provider = new ObjectStoreProvider(); |
| 54 | + var containerList = provider.ListContainers(_testIdentity); |
| 55 | + |
| 56 | + Assert.IsNotNull(containerList); |
| 57 | + Assert.IsTrue(containerList.Any()); |
| 58 | + } |
| 59 | + |
| 60 | + [TestMethod] |
| 61 | + public void Should_Return_Container_List_With_Limit() |
| 62 | + { |
| 63 | + var provider = new ObjectStoreProvider(); |
| 64 | + var containerList = provider.ListContainers(_testIdentity,1); |
| 65 | + |
| 66 | + Assert.IsNotNull(containerList); |
| 67 | + Assert.AreEqual(1, containerList.Count()); |
| 68 | + } |
| 69 | + |
| 70 | + [TestMethod] |
| 71 | + public void Should_Return_Container_List_With_Start_Marker_Lower_Case() |
| 72 | + { |
| 73 | + var provider = new ObjectStoreProvider(); |
| 74 | + var containerList = provider.ListContainers(_testIdentity, null,"a"); |
| 75 | + |
| 76 | + Assert.IsNotNull(containerList); |
| 77 | + Assert.IsTrue(containerList.Any()); |
| 78 | + } |
| 79 | + |
| 80 | + [TestMethod] |
| 81 | + public void Should_Return_Container_List_With_Start_Marker_Upper_Case() |
| 82 | + { |
| 83 | + var provider = new ObjectStoreProvider(); |
| 84 | + var containerList = provider.ListContainers(_testIdentity, null, "A"); |
| 85 | + |
| 86 | + Assert.IsNotNull(containerList); |
| 87 | + Assert.IsTrue(containerList.Any()); |
| 88 | + } |
| 89 | + |
| 90 | + |
| 91 | + [TestMethod] |
| 92 | + public void Should_Return_Container_List_With_End_Marker_Upper_Case() |
| 93 | + { |
| 94 | + var provider = new ObjectStoreProvider(); |
| 95 | + var containerList = provider.ListContainers(_testIdentity, null, null,"L"); |
| 96 | + |
| 97 | + Assert.IsNotNull(containerList); |
| 98 | + Assert.IsTrue(containerList.Any()); |
| 99 | + } |
| 100 | + |
| 101 | + [TestMethod] |
| 102 | + public void Should_Return_Container_List_With_End_Marker_Lower_Case() |
| 103 | + { |
| 104 | + var provider = new ObjectStoreProvider(); |
| 105 | + var containerList = provider.ListContainers(_testIdentity, null, null, "l"); |
| 106 | + |
| 107 | + Assert.IsNotNull(containerList); |
| 108 | + Assert.IsTrue(containerList.Any()); |
| 109 | + } |
| 110 | + |
| 111 | + |
| 112 | + } |
| 113 | +} |
0 commit comments