public async Task SignIn_Fails() { var req = new SignInRequest(); this.mockUserService.Setup(u => u.Authenticate(req.Username, req.Password)).ReturnsAsync(false); var res = await this.signInFacade.Authenticate(req); Assert.IsNull(res); }
public async Task SignIn() { var req = new SignInRequest { Username = "******", Password = "******" }; this.mockUserService.Setup(u => u.Authenticate(req.Username, req.Password)).Returns(Task.FromResult(true)); var res = await this.signInFacade.Authenticate(req); Assert.AreEqual(req.Username, res.Username); }
public async Task<SignInResponse> Authenticate(SignInRequest req) { bool succeed; using (await this.unitOfWorkProvider.Create("ro")) { succeed = await this.userService.Authenticate(req.Username, req.Password); } if (!succeed) { return null; } return new SignInResponse { Username = req.Username }; }