Esempio n. 1
0
        public async Task Handle_GivenInvalidOperationResult()
        {
            //Arrange
            const int createId = 10;
            var       command  = new CreateAuthenticationOptionCommand {
                AuthenticationOptionId = createId, RouteId = 1
            };

            //Assert
            await Assert.ThrowsAsync <InvalidOperationException>(() => _handler.Handle(command, CancellationToken.None));
        }
Esempio n. 2
0
        public async Task Handle_GivenValidResult()
        {
            //Arrange
            const int createId = 35;
            var       command  = new CreateAuthenticationOptionCommand {
                AuthenticationOptionId = createId, RouteId = 1
            };

            //Act
            await _handler.Handle(command, CancellationToken.None);

            var unit = await Context.AuthenticationOptions.FindAsync(createId);

            //Assert
            Assert.Equal(createId, unit.AuthenticationOptionId);
            Assert.Equal(1, unit.RouteId);
        }
Esempio n. 3
0
        public async Task <IActionResult> Create([FromBody] CreateAuthenticationOptionCommand command)
        {
            await Mediator.Send(command);

            return(NoContent());
        }