예제 #1
0
        public static string SelectRandomRecord(
            ClientLogicalForm form,
            string keyFieldCaption)
        {
            // selects a random row from the repeater
            var rowCount    = form.Repeater().DefaultViewport.Count;
            var rowToSelect = SafeRandom.GetRandomNext(rowCount);
            var rowControl  = form.Repeater().DefaultViewport[rowToSelect];
            var randomKey   = rowControl.Control(keyFieldCaption).StringValue;

            return(randomKey);
        }
        public static string SelectRandomRecordFromListPage(TestContext testContext, int pageId, UserContext context, string keyFieldCaption)
        {
            string randomKey = null;

            RunPageAction(testContext, context, pageId, form =>
            {
                // selects a random row from the first page of results
                int rowCount    = form.Repeater().DefaultViewport.Count;
                int rowToSelect = SafeRandom.GetRandomNext(rowCount);
                var rowControl  = form.Repeater().DefaultViewport[rowToSelect];
                randomKey       = rowControl.Control(keyFieldCaption).StringValue;
                testContext.WriteLine("Selected Random Record Page:{0} Key:{1} Value:{2}", pageId, keyFieldCaption, randomKey);
            });
            return(randomKey);
        }