Пример #1
0
        public async Task FunctionDispatcherState_Transitions_From_Default_To_Initialized_To_Disposing()
        {
            RpcFunctionInvocationDispatcher functionDispatcher = GetTestFunctionDispatcher();

            Assert.Equal(FunctionInvocationDispatcherState.Default, functionDispatcher.State);
            FunctionMetadata func1 = new FunctionMetadata()
            {
                Name     = "func1",
                Language = "node"
            };
            var functions = new List <FunctionMetadata>()
            {
                func1
            };
            await functionDispatcher.InitializeAsync(functions);

            Assert.Equal(FunctionInvocationDispatcherState.Initializing, functionDispatcher.State);
            await WaitForFunctionDispactherStateInitialized(functionDispatcher);

            Assert.Equal(FunctionInvocationDispatcherState.Initialized, functionDispatcher.State);
            functionDispatcher.Dispose();
            Assert.True(functionDispatcher == null || functionDispatcher.State == FunctionInvocationDispatcherState.Disposing || functionDispatcher.State == FunctionInvocationDispatcherState.Disposed);
        }