public void ErrorWhenNameIsInvalid() { var command = new CreateBoletoSubscriptionCommand(); command.FirstName = ""; command.Validate(); Assert.IsTrue(command.Invalid); }
public void ShoulReturnErrorWhenBNameIsInvalid() { var command = new CreateBoletoSubscriptionCommand(); command.FirstName = ""; command.Validate(); Assert.AreEqual(false, command.IsValid); }
public void ShouldReturnErrorWhenNameIsInvalid() { var command = new CreateBoletoSubscriptionCommand(); command.FirstName = ""; command.Validate(); Assert.IsFalse(command.Valid); }
public void TestMethod1() { var command = new CreateBoletoSubscriptionCommand { FirstName = "" }; command.Validate(); Assert.AreEqual(false, command.Valid); }
public void ShoulReturnErrorWhenNameIsInvalid() { var command = new CreateBoletoSubscriptionCommand(); command.FirstName = ""; command.Validate();// método que possui as validações dentro do command Assert.AreEqual(true, command.Invalid); }
public void ShouldReturnErrorWhenNameIsInvalid() { var boletoCommand = new CreateBoletoSubscriptionCommand(); boletoCommand.FirstName = ""; boletoCommand.Validate(); Assert.AreEqual(false, boletoCommand.Valid); }
public void Should_Return_Error_When_Name_Is_Invalid() { var command = new CreateBoletoSubscriptionCommand(); command.FirstName = ""; command.Validate(); Assert.AreEqual(false, command.Valid); }
public void NameIsInvalid() { var command = new CreateBoletoSubscriptionCommand(); command.FirstName = ""; command.Validate(); Assert.AreEqual(false, command.Valid); }
public void DeveRetornarErrorQuandoNome_Invalido() { var command = new CreateBoletoSubscriptionCommand(); command.FirstName = ""; command.Validate(); Assert.AreEqual(false, command.Valid); }
public void ShouldReturnSuccessWhenNameIsValid() { var command = new CreateBoletoSubscriptionCommand(); command.FirstName = "Bruce"; command.Validate(); Assert.AreEqual(true, command.Valid); }
public void ShouldReturnBadRequestWhenNameIsInvalid() { var command = new CreateBoletoSubscriptionCommand(); command.FirstName = ""; command.Validate(); Assert.AreEqual(false, command.Valid); }
public void ShouldReturnErrorWhenNameIsTooLong() { var command = new CreateBoletoSubscriptionCommand(); command.FirstName = "AndreAndreAndreAndreAndreAndreAndse"; command.Validate(); Assert.AreEqual(false, command.Valid); }
public void DevoRetornarErroQuandoNomeEstaInvalido() { var command = new CreateBoletoSubscriptionCommand(); command.FirstName = string.Empty; command.Validate(); Assert.IsTrue(command.Invalid); }
public void ShouldReturnErrorNameIsInvalid() { var command = new CreateBoletoSubscriptionCommand(); command.FirstName = string.Empty; command.Validate(); Assert.AreEqual(false, command.Valid); }
public void ShouldReturnSuccessWhenHadNoActiveSubscription() { var command = new CreateBoletoSubscriptionCommand(); command.FirstName = ""; command.Validate(); Assert.AreEqual(false, command.Valid); }
public void ShouldReturnErroWhenNameIsInvalid() { var command = new CreateBoletoSubscriptionCommand { FisrtName = "" }; command.Validate(); Assert.AreEqual(false, command.Valid); }
public void DeveRetornarErroQuandoNomeEhInvalido() { var command = new CreateBoletoSubscriptionCommand(); command.FirstName = ""; command.LastName = ""; command.Validate(); Assert.IsFalse(command.Valid); }
public void ShouldReturnErrorWhenNameIsInvalid() { //exemplo para validar/ testar a validacao do command, mesmo não sendo necessario esse teste var command = new CreateBoletoSubscriptionCommand(); command.FirstName = ""; command.Validate(); Assert.AreEqual(false, command.Valid); }
public void CommandInvalidReturn() { var command = new CreateBoletoSubscriptionCommand() { FirstName = "", LastName = "" }; command.Validate(); Assert.AreEqual(false, command.Valid); }
public void SholdReturnErrorWhenNameIsValid() { var command = new CreateBoletoSubscriptionCommand { FirstName = _firstname, LastName = _lastname }; command.Validate(); Assert.AreEqual(true, command.Valid); }
public ICommandResult Handle(CreateBoletoSubscriptionCommand command) { command.Validate(); if (!command.IsValid) { AddNotifications(command); return(new CommandResult(false, "Não foi possível realizar sua assinatura")); } if (_repository.DocumentExists(command.Document)) { AddNotification("Document", "O número do documento já está em uso"); } if (_repository.EmailExists(command.Document)) { AddNotification("Document", "Este email já está em uso"); } var name = new Name(command.FirstName, command.LastName); var document = new Document(command.Document, Enums.EDocumentType.CPF); var email = new Email(command.Email); var address = new Address(command.Street, command.Number, command.Neighborhood, command.City, command.State, command.Country, command.ZipCode); var student = new Student(name, document, email); var subscription = new Subscription(DateTime.Now.AddMonths(1)); var payment = new BoletoPayment(command.PaidDate, command.ExpireDate, command.Total, command.TotalPaid, command.Payer, new Document(command.PayerDocument, command.PayerDocumentType), address, email, command.BarCode, command.BoletoNumber); subscription.AddPayment(payment); student.AddSubscriptions(subscription); AddNotifications(name, document, email, address, student, payment, subscription); if (!IsValid) { return(new CommandResult(false, "Erro ao criar assinatura")); } _repository.CreateSubscription(student); _emailService.Send(student.Name.ToString(), student.Email.Address, "Bem Vindo!", "Sua assinatura foi criada!"); return(new CommandResult(true, "Assinatura realizada com sucesso")); }
public void ShouldReturnErrorWhenNameIsInvalid() { //Given var command = new CreateBoletoSubscriptionCommand(); command.FirstName = ""; //When command.Validate(); //Then Assert.False(command.Valid); }
public void ShouldReturnErrorWhenDocumentExists() { //Arrange var command = new CreateBoletoSubscriptionCommand(); command.FirstName = ""; //Act command.Validate(); //Assert Assert.IsTrue(command.Invalid); }
public ICommandResult Handle(CreateBoletoSubscriptionCommand command) { command.Validate(); if (!command.IsValid) { AddNotifications(command); return(new CommandResult(false, "Não foi possível realizar o seu cadastro")); } if (_repository.DocumentExists(command.Document)) { AddNotification("Document", "Document already exists."); } if (_repository.EmailExists(command.Email)) { AddNotification("Email", "E-mail already exists"); } var name = new Name(command.FirstName, command.LastName); var document = new Document(command.PayerDocument, command.PayerDocumentType); var email = new Email(command.Email); var address = new Address(command.Street, command.Number, command.Neighborhood, command.City, command.State, command.Country, command.ZipCode); var student = new Student(name, document, email); var subscription = new Subscription(DateTime.Now.AddMonths(1)); var payment = new BoletoPayment(command.BarCode, command.BoletoNumber, command.PaidDate, command.ExpireDate, command.Total, command.TotalPaid, command.Payer, document, address, email); subscription.AddPayment(payment); student.AddSubscription(subscription); AddNotifications(name, document, email, address, student, subscription, payment); if (!IsValid) { return(new CommandResult(false, "It is not possible to complete the subscription")); } _repository.CreateSubscription(student); _emailService.Send(student.Name.ToString(), student.Email.Address, "Welcome to the network.", "Your registered had been completed successfully."); return(new CommandResult(true, "Subscription registered successfully.")); }
public ICommandResult Handle(CreateBoletoSubscriptionCommand command) { // Fail Fast Validations command.Validate(); if (command.IsValid) { AddNotifications(command); return(new CommandResult(false, "Não foi possível realizar sua assinatura")); } // Verificar se Documento já está cadastrado if (_repository.DocumentExists(command.Document)) { AddNotification("Document", "Este CPF já está em uso"); } // Verificar se E-mail já está cadastrado if (_repository.EmailExists(command.Email)) { AddNotification("Email", "Este E-mail já está em uso"); } // Gerar os VOs var name = new Name(command.FirstName, command.LastName); var document = new Document(command.Document, EDocumentType.CPF); var email = new Email(command.Email); var address = new Address(command.Street, command.Number, command.Neighborhood, command.City, command.State, command.Country, command.ZipCode); // Gerar as Entidades var student = new Student(name, document, email); var subscription = new Subscription(DateTime.Now.AddMonths(1)); var payment = new BoletoPayment( command.BarCode, command.BoletoNumber, command.PaidDate, command.ExpireDate, command.Total, command.TotalPaid, command.Payer, new Document(command.PayerDocument, command.PayerDocumentType), address, email ); // Relacionamentos subscription.AddPayment(payment); student.AddSubscription(subscription); // Agrupar as Validações AddNotifications(name, document, email, address, student, subscription, payment); // Checar as notificações if (IsValid)//Invalid { return(new CommandResult(false, "Não foi possível realizar sua assinatura")); } // Salvar as Informações _repository.CreateSubscription(student); // Enviar E-mail de boas vindas _emailService.Send(student.Name.ToString(), student.Email.Address, "bem vindo ao balta.io", "Sua assinatura foi criada"); // Retornar informações return(new CommandResult(true, "Assinatura realizada com sucesso")); }