예제 #1
0
        public void GetFunctionTraceLevel_ReturnsExpectedLevel(string method, TraceLevel level)
        {
            // Arrange
            var             collector = new TestIndexCollector();
            FunctionIndexer product   = CreateProductUnderTest();

            // Act & Assert
            product.IndexMethodAsync(typeof(FunctionIndexerTests).GetMethod(method),
                                     collector, CancellationToken.None).GetAwaiter().GetResult();

            Assert.Equal(level, collector.Functions.First().TraceLevel);
        }
예제 #2
0
        public void GetFunctionTimeout_ReturnsExpected()
        {
            // Arrange
            var             collector = new TestIndexCollector();
            FunctionIndexer product   = CreateProductUnderTest();

            // Act & Assert
            product.IndexMethodAsync(typeof(FunctionIndexerTests).GetMethod("Timeout_Set"),
                                     collector, CancellationToken.None).GetAwaiter().GetResult();

            Assert.Equal(TimeSpan.FromMinutes(30), collector.Functions.First().TimeoutAttribute.Timeout);
        }
        public async Task FSharpTasks_AreCorrectlyIndexed()
        {
            // Arrange
            MethodInfo method = typeof(FSharpFunctions.TestFunction).GetMethod("TaskTest",
                                                                               BindingFlags.Static | BindingFlags.Public);

            Assert.NotNull(method); // Guard

            FunctionIndexer indexer        = FunctionIndexerFactory.Create(CloudStorageAccount.DevelopmentStorageAccount);
            var             indexCollector = new TestIndexCollector();

            // Act & Assert
            await indexer.IndexMethodAsyncCore(method, indexCollector, CancellationToken.None);

            Assert.Contains(indexCollector.Functions, d => string.Equals(d.ShortName, "TestFunction.TaskTest"));
        }