public void Constructor_Validates_Parameters() { // Arrange LambdaTestServerOptions options = null; // Act and Assert Assert.Throws <ArgumentNullException>("options", () => new LambdaTestServer(options)); }
public static void Constructor_Initializes_Defaults() { // Act var actual = new LambdaTestServerOptions(); // Assert actual.Configure.ShouldBeNull(); actual.FunctionArn.ShouldNotBeNullOrEmpty(); actual.FunctionHandler.ShouldBe(string.Empty); actual.FunctionMemorySize.ShouldBe(128); actual.FunctionTimeout.ShouldBe(TimeSpan.FromSeconds(3)); actual.FunctionVersion.ShouldBe(1); actual.LogGroupName.ShouldNotBeNullOrEmpty(); actual.LogStreamName.ShouldNotBeNullOrEmpty(); }
/// <summary> /// Initializes a new instance of the <see cref="RuntimeHandler"/> class. /// </summary> /// <param name="options">The test server's options.</param> /// <param name="cancellationToken">The cancellation token that is signalled when request listening should stop.</param> internal RuntimeHandler(LambdaTestServerOptions options, CancellationToken cancellationToken) { _cancellationToken = cancellationToken; _options = options; // Support multi-threaded access to the request queue, although the default // usage scenario would be a single reader and writer from a test method. var channelOptions = new UnboundedChannelOptions() { SingleReader = false, SingleWriter = false, }; _requests = Channel.CreateUnbounded <LambdaTestRequest>(channelOptions); _responses = new ConcurrentDictionary <string, Channel <LambdaTestResponse> >(StringComparer.Ordinal); }
/// <summary> /// Initializes a new instance of the <see cref="LambdaTestServer"/> class. /// </summary> /// <param name="options">The options to use to configure the test Lambda runtime server.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="options"/> is <see langword="null"/>. /// </exception> public LambdaTestServer(LambdaTestServerOptions options) { Options = options ?? throw new ArgumentNullException(nameof(options)); _onDisposed = new CancellationTokenSource(); }