public async void GetSingleUser() { string expectedEmail = "*****@*****.**"; ICommand command = new QueryCommand(); User user = await command.GetSingleUserByIdAsync(1); //AuthenticationController auth = new AuthenticationController(); //HttpResponseMessage msg = await auth.GetUser(1); Assert.AreEqual(expectedEmail, user.Email); }
public async Task <HttpResponseMessage> GetUser(int id) { ICommand command = new QueryCommand(); User user = await command.GetSingleUserByIdAsync(id); if (user != null) { var message = "Success user " + user.Email; var response = Request.CreateResponse <ResponseMessage <User> >(HttpStatusCode.OK, new ResponseMessage <User> { Status = true, ReturnMessage = message, ReturnResult = user }); return(response); } return(Request.CreateResponse <ResponseMessage>(HttpStatusCode.OK, new ResponseMessage { Status = false, ReturnMessage = "This user does not exist" })); }