Exemple #1
0
        public async Task Handle_invalid_user_data(string clienteId, string clienteNome, string clienteEmail, string clienteTelefone, string clienteEndereco, string clienteComplemento, string clienteBairro, string clienteMunicipio, string clienteUF, string clienteCEP)
        {
            //arrange
            var handler = new CadastroCommandHandler(mediatorMock.Object, loggerMock.Object, claimsManagerMock.Object);

            CadastroCommand command = new CadastroCommand(clienteId, clienteNome, clienteEmail, clienteTelefone, clienteEndereco, clienteComplemento, clienteBairro, clienteMunicipio, clienteUF, clienteCEP);
            IdentifiedCommand <CadastroCommand, bool> request = new IdentifiedCommand <CadastroCommand, bool>(command, Guid.NewGuid());
            CancellationToken token = default(System.Threading.CancellationToken);
            //act
            //assert
            await Assert.ThrowsAsync <InvalidUserDataException>(() => handler.Handle(request, token));
        }
Exemple #2
0
        public async Task Handle_success()
        {
            //arrange
            claimsManagerMock
            .Setup(c => c.AddUpdateClaim(It.IsAny <string>(), It.IsAny <IDictionary <string, string> >()))
            .Returns(Task.CompletedTask)
            .Verifiable();

            var             handler = new CadastroCommandHandler(mediatorMock.Object, loggerMock.Object, claimsManagerMock.Object);
            CadastroCommand command = new CadastroCommand("clienteId", "clienteNome", "*****@*****.**", "fone", "endereco", "complemento", "bairro", "municipio", "uf", "12345-678");

            IdentifiedCommand <CadastroCommand, bool> request = new IdentifiedCommand <CadastroCommand, bool>(command, Guid.NewGuid());
            CancellationToken token = default(CancellationToken);

            //act
            var result = await handler.Handle(request, token);

            //assert
            Assert.True(result);
            claimsManagerMock.Verify();
        }