public AuthSigninCommand(AuthSigninModel model) { if (model == null) { throw new ArgumentNullException(nameof(model)); } this.Model = model; }
public async Task <IActionResult> Signin([FromBody] AuthSigninModel model) { if (!ModelState.IsValid) { return(new BadRequestObjectResult("Invalid model inputs")); } var command = new AuthSigninCommand(model); var result = this._mediator.Send(command).Result; if (result == null) { return(new BadRequestObjectResult("Something went wrong")); } if (result.GetType() == typeof(bool) && (bool)result == false) { return(new BadRequestObjectResult("Something went wrong")); } return(new OkObjectResult(result)); }
public async void AuthSigninCommand_ModelNull_Test() { AuthSigninModel model = null; Assert.Throws <ArgumentNullException>(() => new AuthSigninCommand(model)); }