示例#1
0
        public async Task <IActionResult> StopKeys([FromServices] HttpPostDecoyKeysCommand command)
        {
            if (command == null)
            {
                throw new ArgumentNullException(nameof(command));
            }

            _Logger.LogInformation("POST stopkeys triggered.");
            return(await command.Execute());
        }
示例#2
0
        public void Execute_takes_at_least_N_milliseconds(int n)
        {
            // Assemble
            var command = new HttpPostDecoyKeysCommand(new TestLogger <HttpPostDecoyKeysCommand>(), new TestRng(n), new DefaultDecoyKeysConfig());
            var timer   = new Stopwatch();

            // Act
            timer.Start();
            var result = command.Execute().Result;

            timer.Stop();

            // Assert
            Assert.IsNotNull(result);
            Assert.IsTrue(timer.ElapsedMilliseconds >= n);
        }