Beispiel #1
0
        /// <summary>
        /// Functional Cases : for Get-AzureStorageTable
        /// 1. Validate that all the tables can be enumerated (Positive 5)
        /// </summary>
        internal void EnumerateAllTables(Agent agent)
        {
            //--------------Get operation--------------
            Test.Assert(agent.GetAzureStorageTable(""), Utility.GenComparisonData("EnumerateAllTables", false));

            // Verification for returned values
            agent.OutputValidation(_StorageAccount.CreateCloudTableClient().ListTables());
        }
Beispiel #2
0
        /// <summary>
        /// Negative Functional Cases : for Get-AzureStorageTable
        /// 1. Get a non-existing table (Negative 1)
        /// </summary>
        internal void GetNonExistingTable(Agent agent)
        {
            string TABLE_NAME = Utility.GenNameString("nonexisting");

            // Delete the table if it exists
            CloudTable table = _StorageAccount.CreateCloudTableClient().GetTableReference(TABLE_NAME);

            table.DeleteIfExists();

            //--------------Get operation--------------
            Test.Assert(!agent.GetAzureStorageTable(TABLE_NAME), Utility.GenComparisonData("GetAzureStorageTable", false));
            // Verification for returned values
            Test.Assert(agent.Output.Count == 0, "Only 0 row returned : {0}", agent.Output.Count);
            Test.Assert(agent.ErrorMessages[0].Equals(String.Format("Can not find table '{0}'.", TABLE_NAME)), agent.ErrorMessages[0]);
        }
Beispiel #3
0
        internal void StorageTableTest(Agent agent)
        {
            string NEW_TABLE_NAME = Utility.GenNameString("Washington");

            //--------------New operation--------------
            Test.Assert(!agent.NewAzureStorageTable(NEW_TABLE_NAME), Utility.GenComparisonData("NewAzureStorageTable", false));
            CheckErrorOutput(agent);

            //--------------Get operation--------------
            Test.Assert(!agent.GetAzureStorageTable(NEW_TABLE_NAME), Utility.GenComparisonData("GetAzureStorageTable", false));
            CheckErrorOutput(agent);

            //--------------Remove operation--------------
            Test.Assert(!agent.RemoveAzureStorageTable(NEW_TABLE_NAME), Utility.GenComparisonData("RemoveAzureStorageTable", false));
            CheckErrorOutput(agent);
        }
        internal void StorageTableTest(Agent agent)
        {
            string NEW_TABLE_NAME = Utility.GenNameString("Washington");

            //--------------New operation--------------
            Test.Assert(!agent.NewAzureStorageTable(NEW_TABLE_NAME), Utility.GenComparisonData("NewAzureStorageTable", false));
            CheckErrorOutput(agent);

            //--------------Get operation--------------
            Test.Assert(!agent.GetAzureStorageTable(NEW_TABLE_NAME), Utility.GenComparisonData("GetAzureStorageTable", false));
            CheckErrorOutput(agent);

            //--------------Remove operation--------------
            Test.Assert(!agent.RemoveAzureStorageTable(NEW_TABLE_NAME), Utility.GenComparisonData("RemoveAzureStorageTable", false));
            CheckErrorOutput(agent);
        }
Beispiel #5
0
        /// <summary>
        /// Functional Cases : for New-AzureStorageTable
        /// 1. Create a list of new Tables (Positive 2)
        /// 2. Create a list of Tables that already exist (Negative 4)
        /// 3. Create a list of Tables that some of them already exist (Negative 5)
        /// 
        /// Functional Cases : for Get-AzureStorageTable
        /// 4.	Get a list of Tables by using wildcards in the name (Positive 4)
        /// 5.	Get a list of tables by using Prefix parameter (Positive 2)
        /// 
        /// Functional Cases : for Remove-AzureStorageTable
        /// 6.	Remove a list of existing Tables by using pipeline (Positive 4)
        /// </summary>
        internal void TableListOperations(Agent agent)
        {
            string PREFIX = Utility.GenNameString("uniqueprefix");
            string[] TABLE_NAMES = new string[] { Utility.GenNameString(PREFIX), Utility.GenNameString(PREFIX), Utility.GenNameString(PREFIX) };

            // PART_EXISTING_NAMES differs only the last element with Table_NAMES
            string[] PARTLY_EXISTING_NAMES = new string[TABLE_NAMES.Length];
            Array.Copy(TABLE_NAMES, PARTLY_EXISTING_NAMES, TABLE_NAMES.Length - 1);
            PARTLY_EXISTING_NAMES[TABLE_NAMES.Length - 1] = Utility.GenNameString(PREFIX);

            string[] MERGED_NAMES = TABLE_NAMES.Union(PARTLY_EXISTING_NAMES).ToArray();
            Array.Sort(MERGED_NAMES);

            // Generate the comparison data
            Collection<Dictionary<string, object>> comp = new Collection<Dictionary<string, object>>();
            foreach (string name in MERGED_NAMES)
            {
                comp.Add(Utility.GenComparisonData(StorageObjectType.Table, name));
            }

            CloudTableClient tableClient = _StorageAccount.CreateCloudTableClient();

            // Check if all the above Tables have been removed
            foreach (string name in MERGED_NAMES)
            {
                CloudTable Table = tableClient.GetTableReference(name);
                Table.DeleteIfExists();
            }

            //--------------1. New operation--------------
            Test.Assert(agent.NewAzureStorageTable(TABLE_NAMES), Utility.GenComparisonData("NewAzureStorageTable", true));
            // Verification for returned values
            Test.Assert(agent.Output.Count == TABLE_NAMES.Count(), "{0} row returned : {1}", TABLE_NAMES.Count(), agent.Output.Count);

            // Check if all the above tables have been created
            foreach (string name in TABLE_NAMES)
            {
                CloudTable table = tableClient.GetTableReference(name);
                Test.Assert(table.Exists(), "table {0} should exist", name);
            }

            try
            {
                //--------------2. New operation--------------
                Test.Assert(!agent.NewAzureStorageTable(TABLE_NAMES), Utility.GenComparisonData("NewAzureStorageTable", false));
                // Verification for returned values
                Test.Assert(agent.Output.Count == 0, "0 row returned : {0}", agent.Output.Count);
                int i = 0;
                foreach (string name in TABLE_NAMES)
                {
                    Test.Assert(agent.ErrorMessages[i].Equals(String.Format("Table '{0}' already exists.", name)), agent.ErrorMessages[i]);
                    ++i;
                }

                //--------------3. New operation--------------
                Test.Assert(!agent.NewAzureStorageTable(PARTLY_EXISTING_NAMES), Utility.GenComparisonData("NewAzureStorageTable", false));
                // Verification for returned values
                Test.Assert(agent.Output.Count == 1, "1 row returned : {0}", agent.Output.Count);

                // Check if all the above tables have been created
                foreach (string name in TABLE_NAMES)
                {
                    CloudTable table = tableClient.GetTableReference(name);
                    Test.Assert(table.Exists(), "table {0} should exist", name);
                }

                //--------------4. Get operation--------------
                Test.Assert(agent.GetAzureStorageTable("*" + PREFIX + "*"), Utility.GenComparisonData("GetAzureStorageTable", true));
                // Verification for returned values
                agent.OutputValidation(_StorageAccount.CreateCloudTableClient().ListTables(PREFIX));

                // use Prefix parameter
                Test.Assert(agent.GetAzureStorageTableByPrefix(PREFIX), Utility.GenComparisonData("GetAzureStorageTableByPrefix", true));
                // Verification for returned values
                agent.OutputValidation(_StorageAccount.CreateCloudTableClient().ListTables(PREFIX));
            }
            finally {
                //--------------5. Remove operation--------------
                Test.Assert(agent.RemoveAzureStorageTable(MERGED_NAMES), Utility.GenComparisonData("RemoveAzureStorageTable", true));
                // Check if all the above tables have been removed
                foreach (string name in TABLE_NAMES)
                {
                    CloudTable table = tableClient.GetTableReference(name);
                    Test.Assert(!table.Exists(), "table {0} should not exist", name);
                }
            }
        }
Beispiel #6
0
        /// <summary>
        /// Negative Functional Cases : for Get-AzureStorageTable 
        /// 1. Get a non-existing table (Negative 1)
        /// </summary>
        internal void GetNonExistingTable(Agent agent)
        {
            string TABLE_NAME = Utility.GenNameString("nonexisting");

            // Delete the table if it exists
            CloudTable table = _StorageAccount.CreateCloudTableClient().GetTableReference(TABLE_NAME);
            table.DeleteIfExists();

            //--------------Get operation--------------
            Test.Assert(!agent.GetAzureStorageTable(TABLE_NAME), Utility.GenComparisonData("GetAzureStorageTable", false));
            // Verification for returned values
            Test.Assert(agent.Output.Count == 0, "Only 0 row returned : {0}", agent.Output.Count);
            Test.Assert(agent.ErrorMessages[0].Equals(String.Format("Can not find table '{0}'.", TABLE_NAME)), agent.ErrorMessages[0]);
        }
Beispiel #7
0
        /// <summary>
        /// Functional Cases : for Get-AzureStorageTable
        /// 1. Validate that all the tables can be enumerated (Positive 5)
        /// </summary>
        internal void EnumerateAllTables(Agent agent)
        {
            //--------------Get operation--------------
            Test.Assert(agent.GetAzureStorageTable(""), Utility.GenComparisonData("EnumerateAllTables", false));

            // Verification for returned values
            agent.OutputValidation(_StorageAccount.CreateCloudTableClient().ListTables());
        }
Beispiel #8
0
        /// <summary>
        /// Functional Cases : for New-AzureStorageTable
        /// 1. Create a list of new Tables (Positive 2)
        /// 2. Create a list of Tables that already exist (Negative 4)
        /// 3. Create a list of Tables that some of them already exist (Negative 5)
        ///
        /// Functional Cases : for Get-AzureStorageTable
        /// 4.	Get a list of Tables by using wildcards in the name (Positive 4)
        /// 5.	Get a list of tables by using Prefix parameter (Positive 2)
        ///
        /// Functional Cases : for Remove-AzureStorageTable
        /// 6.	Remove a list of existing Tables by using pipeline (Positive 4)
        /// </summary>
        internal void TableListOperations(Agent agent)
        {
            string PREFIX = Utility.GenNameString("uniqueprefix");

            string[] TABLE_NAMES = new string[] { Utility.GenNameString(PREFIX), Utility.GenNameString(PREFIX), Utility.GenNameString(PREFIX) };

            // PART_EXISTING_NAMES differs only the last element with Table_NAMES
            string[] PARTLY_EXISTING_NAMES = new string[TABLE_NAMES.Length];
            Array.Copy(TABLE_NAMES, PARTLY_EXISTING_NAMES, TABLE_NAMES.Length - 1);
            PARTLY_EXISTING_NAMES[TABLE_NAMES.Length - 1] = Utility.GenNameString(PREFIX);

            string[] MERGED_NAMES = TABLE_NAMES.Union(PARTLY_EXISTING_NAMES).ToArray();
            Array.Sort(MERGED_NAMES);

            // Generate the comparison data
            Collection <Dictionary <string, object> > comp = new Collection <Dictionary <string, object> >();

            foreach (string name in MERGED_NAMES)
            {
                comp.Add(Utility.GenComparisonData(StorageObjectType.Table, name));
            }

            CloudTableClient tableClient = _StorageAccount.CreateCloudTableClient();

            // Check if all the above Tables have been removed
            foreach (string name in MERGED_NAMES)
            {
                CloudTable Table = tableClient.GetTableReference(name);
                Table.DeleteIfExists();
            }

            //--------------1. New operation--------------
            Test.Assert(agent.NewAzureStorageTable(TABLE_NAMES), Utility.GenComparisonData("NewAzureStorageTable", true));
            // Verification for returned values
            Test.Assert(agent.Output.Count == TABLE_NAMES.Count(), "{0} row returned : {1}", TABLE_NAMES.Count(), agent.Output.Count);

            // Check if all the above tables have been created
            foreach (string name in TABLE_NAMES)
            {
                CloudTable table = tableClient.GetTableReference(name);
                Test.Assert(table.Exists(), "table {0} should exist", name);
            }

            try
            {
                //--------------2. New operation--------------
                Test.Assert(!agent.NewAzureStorageTable(TABLE_NAMES), Utility.GenComparisonData("NewAzureStorageTable", false));
                // Verification for returned values
                Test.Assert(agent.Output.Count == 0, "0 row returned : {0}", agent.Output.Count);
                int i = 0;
                foreach (string name in TABLE_NAMES)
                {
                    Test.Assert(agent.ErrorMessages[i].Equals(String.Format("Table '{0}' already exists.", name)), agent.ErrorMessages[i]);
                    ++i;
                }

                //--------------3. New operation--------------
                Test.Assert(!agent.NewAzureStorageTable(PARTLY_EXISTING_NAMES), Utility.GenComparisonData("NewAzureStorageTable", false));
                // Verification for returned values
                Test.Assert(agent.Output.Count == 1, "1 row returned : {0}", agent.Output.Count);

                // Check if all the above tables have been created
                foreach (string name in TABLE_NAMES)
                {
                    CloudTable table = tableClient.GetTableReference(name);
                    Test.Assert(table.Exists(), "table {0} should exist", name);
                }

                //--------------4. Get operation--------------
                Test.Assert(agent.GetAzureStorageTable("*" + PREFIX + "*"), Utility.GenComparisonData("GetAzureStorageTable", true));
                // Verification for returned values
                agent.OutputValidation(_StorageAccount.CreateCloudTableClient().ListTables(PREFIX));

                // use Prefix parameter
                Test.Assert(agent.GetAzureStorageTableByPrefix(PREFIX), Utility.GenComparisonData("GetAzureStorageTableByPrefix", true));
                // Verification for returned values
                agent.OutputValidation(_StorageAccount.CreateCloudTableClient().ListTables(PREFIX));
            }
            finally {
                //--------------5. Remove operation--------------
                Test.Assert(agent.RemoveAzureStorageTable(MERGED_NAMES), Utility.GenComparisonData("RemoveAzureStorageTable", true));
                // Check if all the above tables have been removed
                foreach (string name in TABLE_NAMES)
                {
                    CloudTable table = tableClient.GetTableReference(name);
                    Test.Assert(!table.Exists(), "table {0} should not exist", name);
                }
            }
        }