Esempio n. 1
0
        public async Task Deve_Validar_Log_Com_Project_Invalido()
        {
            var logCommand = CreateLogCommandTest.CommandValido();

            var result = await _handler.Handle(logCommand, CancellationToken.None);

            Assert.False(_validationService.IsValid(), "O validation service deve ser invalido");
            Assert.True(result == Guid.Empty, "O ID do log deve retornar vazio.");
            await _logRepository.DidNotReceive().CreateAsync(Arg.Any <Log>());

            await _uow.DidNotReceive().CommitAsync();
        }
Esempio n. 2
0
        public async Task Deve_Incluir_Log_Valido()
        {
            var logCommand = CreateLogCommandTest.CommandValido();

            _projectRepository.GetByApiKey(Arg.Any <Guid>()).Returns(ProjectTest.GetProject());

            var result = await _handler.Handle(logCommand, CancellationToken.None);

            Assert.True(result == Guid.Empty);
            await _logRepository.Received().CreateAsync(Arg.Any <Log>());

            await _uow.Received().CommitAsync();
        }
Esempio n. 3
0
        public async Task Deve_Validar_Log_Com_Command_Invalido()
        {
            var logCommand = CreateLogCommandTest.CommandValido();

            logCommand.Description = "";

            _projectRepository.GetByIDAsync(Arg.Any <Guid>()).Returns(await Task.FromResult(ProjectTest.GetProject()));

            var result = await _handler.Handle(logCommand, CancellationToken.None);

            Assert.False(_validationService.IsValid(), "O validation service deve ser invalido");
            Assert.True(result == Guid.Empty, "O ID do log deve retornar vazio.");
            await _logRepository.DidNotReceive().CreateAsync(Arg.Any <Log>());

            await _uow.DidNotReceive().CommitAsync();
        }