public void UserInsertCommand_invalid_login_invalid(string param) { UserInsertCommand _command = new UserInsertCommand(); _command.Email = "*****@*****.**"; _command.Login = param; _command.Name = "carlos"; _command.Password = "******"; _command.Role = "role"; _command.Validate(); var _notification = (List <Flunt.Notifications.Notification>)_command.Notifications; Assert.False(_command.Valid); Assert.True(_command.Invalid); Assert.NotEmpty(_command.Email); if (param == null) { Assert.Null(_command.Login); } else { Assert.Empty(_command.Login); } Assert.NotEmpty(_command.Name); Assert.NotEmpty(_command.Password); Assert.NotEmpty(_command.Role); Assert.True(((List <Flunt.Notifications.Notification>)_command.Notifications).Count == 1); Assert.Equal("Login not be null.", _notification[0].Message); }
public void TranslateExternalInsertCommandToAkkaMessage(HTTPSourcedCommand cmdExternal) { UserState cs; if (ExtractStateObject(cmdExternal, out cs)) { UserInsertCommand insertCommand = new UserInsertCommand(cs, cmdExternal.User, cmdExternal.ConnectionId); SendTo.Tell(insertCommand, ReplyTo); } }
public void UserInsertCommand_valid() { UserInsertCommand _command = new UserInsertCommand(); _command.Email = "*****@*****.**"; _command.Login = "******"; _command.Name = "carlos"; _command.Password = "******"; _command.Role = "role"; _command.Validate(); var _notification = (List <Flunt.Notifications.Notification>)_command.Notifications; Assert.True(_command.Valid); Assert.False(_command.Invalid); Assert.NotEmpty(_command.Email); Assert.NotEmpty(_command.Login); Assert.NotEmpty(_command.Name); Assert.NotEmpty(_command.Password); Assert.NotEmpty(_command.Role); Assert.True(((List <Flunt.Notifications.Notification>)_command.Notifications).Count == 0); }
public async Task TruckHandler_insert_invalid() { var mockContextRepository = new Mock <IContextRepository>(); var mockUserRepository = new Mock <IUserRepository>(); UserInsertCommand userInsertCommand = new UserInsertCommand(); userInsertCommand.Login = "******"; userInsertCommand.Email = "*****@*****.**"; userInsertCommand.Password = "******"; userInsertCommand.Name = "Name"; userInsertCommand.Role = "Role"; mockContextRepository.Setup(x => x.Add(It.IsAny <User>())).ReturnsAsync(false); UserHandler _handler = new UserHandler(mockContextRepository.Object, mockUserRepository.Object); var _return = await _handler.Handle(userInsertCommand); Assert.False(_return.Success); Assert.False((bool)_return.Data); Assert.Equal(HttpStatusCode.BadRequest, _return.Code); }
public async Task <GenericCommandResult> PostUser( [FromBody] UserInsertCommand command, [FromServices] IHandler <UserInsertCommand> handler) { return((GenericCommandResult)await handler.Handle(command)); }
public async Task <IActionResult> AddAsync([FromBody] UserInsertCommand userInsertCommand) { var result = await _mediator.Send(userInsertCommand); return(result ? Json(new { HttpStatusCode.OK }) : (IActionResult)BadRequest()); }
private void InsertNewUserRecoveryCommand(UserInsertCommand c) { // When recovering set the state of the actor _ActorState = c.UserStateData; }
public UserInsertRecordedEvent(IActorRef sender, UserInsertCommand c, string user, string connectionId) : base(c.Id, null, UserActor.ActorType, MicroServices.Area.User, "User Insert Recorded", c, user, connectionId) { Sender = sender; }