Exemplo n.º 1
0
        private FunctionInvocationPage FunctionWithQueueArgumentsTest(MethodInfo function)
        {
            InvocationDetails invocation = _storageAccount
                                           .MethodInfoToInvocations(function)
                                           .Single();

            FunctionInvocationPage page      = Dashboard.GoToFunctionInvocationPage(invocation.Id);
            FunctionArgumentsTable arguments = page.DetailsSection.ArgumentsTable;

            FunctionArgumentsTableRow[] rows = arguments
                                               .BodyRows
                                               .Cast <FunctionArgumentsTableRow>()
                                               .ToArray();

            string queueName = string.Format("queue-{0}-in", function.Name.ToLowerInvariant());

            Assert.Equal(string.Format("New queue message detected on '{0}'.", queueName), page.TriggerReason);

            FunctionArgumentsTableRow argumentRow = rows[0];

            Assert.Equal("input", argumentRow.Name);
            Assert.Equal(POCO.JsonSample, argumentRow.Value.TextValue);
            Assert.Equal(string.Empty, argumentRow.Notes);

            argumentRow = rows[1];
            Assert.Equal("output", argumentRow.Name);
            Assert.Equal(
                QueueArgumentsDisplayTestsFixture.CreateQueueName(function, input: false),
                argumentRow.Value.TextValue);
            Assert.Equal(string.Empty, argumentRow.Notes);

            return(page);
        }
Exemplo n.º 2
0
        public void SBQueue2SBTopic_VerifyInvocation()
        {
            FunctionInvocationPage page      = GetInvocationPage(ServiceBusArgumentsDisplayFunctions.SBQueue2SBTopicMethodInfo);
            FunctionArgumentsTable arguments = page.DetailsSection.ArgumentsTable;

            FunctionArgumentsTableRow[] rows = arguments
                                               .BodyRows
                                               .Cast <FunctionArgumentsTableRow>()
                                               .ToArray();

            string expectedMessage = string.Format("New ServiceBus message detected on '{0}'.", ServiceBusArgumentsDisplayFunctions.FirstOutQueue);

            Assert.Equal(expectedMessage, page.TriggerReason);

            FunctionArgumentsTableRow argumentRow = rows[0];

            Assert.Equal("message", argumentRow.Name);
            Assert.Equal("E2E-SBQueue2SBQueue", argumentRow.Value.TextValue);
            Assert.Equal(string.Empty, argumentRow.Notes);

            argumentRow = rows[1];
            Assert.Equal("output", argumentRow.Name);
            Assert.Equal(ServiceBusArgumentsDisplayFunctions.TopicName, argumentRow.Value.TextValue);
            Assert.Equal(string.Empty, argumentRow.Notes);
        }
Exemplo n.º 3
0
        public void FunctionInvocationPage_SuccessfulFunction_Arguments()
        {
            FunctionInvocationPage page = Dashboard.GoToFunctionInvocationPage(SuccessfulInvocationWithLog.Id);

            InvocationDetailsSection section = page.DetailsSection;
            FunctionArgumentsTable   table   = section.ArgumentsTable;

            Assert.True(table.IsUserAccesible);

            FunctionArgumentsTableRow tableRow = table.BodyRows.ElementAt(0) as FunctionArgumentsTableRow;

            Assert.Equal("fail", tableRow.Name);
            Assert.Equal("False", tableRow.Value.TextValue);
            Assert.Equal("", tableRow.Notes);

            tableRow = table.BodyRows.ElementAt(1) as FunctionArgumentsTableRow;
            Assert.Equal("logOnSuccess", tableRow.Name);
            Assert.Equal("True", tableRow.Value.TextValue);
            Assert.Equal("", tableRow.Notes);

            tableRow = table.BodyRows.ElementAt(2) as FunctionArgumentsTableRow;
            Assert.Equal("log", tableRow.Name);
            Assert.Equal("", tableRow.Value.TextValue);
            Assert.Equal("", tableRow.Notes);
        }
Exemplo n.º 4
0
        private void FunctionWithBlobArgumentsTest(MethodInfo function, Action <FunctionArgumentsTableRow[]> customDisplayValidator)
        {
            InvocationDetails invocation = _storageAccount
                                           .MethodInfoToInvocations(function)
                                           .Single();

            FunctionInvocationPage page      = Dashboard.GoToFunctionInvocationPage(invocation.Id);
            FunctionArgumentsTable arguments = page.DetailsSection.ArgumentsTable;

            FunctionArgumentsTableRow[] rows = arguments
                                               .BodyRows
                                               .Cast <FunctionArgumentsTableRow>()
                                               .ToArray();

            string accountName     = _storageAccount.CloudStorageAccount.Credentials.AccountName;
            string blobPartialName = BlobArgumentsDisplayFunctions.ContainerName + "/" + function.Name.ToLowerInvariant();
            string fullBlobName    = blobPartialName + "-trigger";

            Assert.Equal(string.Format("New blob detected: {0}", fullBlobName), page.TriggerReason);

            FunctionArgumentsTableRow argumentRow = rows[0];
            Link blobLink = argumentRow.Value.BlobLink;

            Assert.Equal("trigger", argumentRow.Name);
            Assert.True(blobLink.IsUserAccesible);
            Assert.Equal(fullBlobName, blobLink.Text);
            Assert.Equal(
                Dashboard.Api.ConstructDownloadBlobUrl(fullBlobName, accountName),
                blobLink.Href,
                StringComparer.OrdinalIgnoreCase);

            fullBlobName = blobPartialName + "-in";
            argumentRow  = rows.ElementAt(1);
            blobLink     = argumentRow.Value.BlobLink;
            Assert.Equal("input", argumentRow.Name);
            Assert.True(blobLink.IsUserAccesible);
            Assert.Equal(fullBlobName, blobLink.Text);
            Assert.Equal(
                Dashboard.Api.ConstructDownloadBlobUrl(fullBlobName, accountName),
                blobLink.Href,
                StringComparer.OrdinalIgnoreCase);

            fullBlobName = blobPartialName + "-out";
            argumentRow  = rows.ElementAt(2);
            blobLink     = argumentRow.Value.BlobLink;
            Assert.Equal("output", argumentRow.Name);
            Assert.True(blobLink.IsUserAccesible);
            Assert.Equal(fullBlobName, blobLink.Text);
            Assert.Equal(
                Dashboard.Api.ConstructDownloadBlobUrl(fullBlobName, accountName),
                blobLink.Href,
                StringComparer.OrdinalIgnoreCase);

            customDisplayValidator(rows);
        }
Exemplo n.º 5
0
        public void Queue_Singleton()
        {
            FunctionInvocationPage page = FunctionWithQueueArgumentsTest(QueueArgumentsDisplayFunctions.SingletonMethodInfo);

            FunctionArgumentsTable arguments = page.DetailsSection.ArgumentsTable;

            FunctionArgumentsTableRow[] rows = arguments.BodyRows.Cast <FunctionArgumentsTableRow>().ToArray();

            // verify the implicit singleton parameter
            FunctionArgumentsTableRow argumentRow = rows[3];

            Assert.Equal("(singleton)", argumentRow.Name);
            Assert.Equal("ScopeId: TestScope", argumentRow.Value.TextValue);

            Regex regex = new Regex(@"Lock acquired. Wait time: About (\d*) milliseconds. Lock duration: About (\d*) milliseconds.");

            Assert.True(regex.IsMatch(argumentRow.Notes));
        }