public async Task RegisterUserShouldFail()
        {
            UserService.Models.User user = new UserService.Models.User {
                UserId = "Mukesh", Name = "Mukesh Goel", Contact = "9876543210"
            };
            HttpRequestMessage request   = new HttpRequestMessage();
            MediaTypeFormatter formatter = new JsonMediaTypeFormatter();

            // The endpoint or route of the controller action.
            var httpResponse = await _client.PostAsync <UserService.Models.User>("/api/user", user, formatter);

            // Deserialize and examine results.
            var stringResponse = await httpResponse.Content.ReadAsStringAsync();

            Assert.Equal(HttpStatusCode.Conflict, httpResponse.StatusCode);
            Assert.Equal($"This user id already exists", stringResponse);
        }
        public async Task UpdateUserShouldFail()
        {
            string userId = "Sam";

            UserService.Models.User user = new UserService.Models.User {
                UserId = "Sam", Contact = "1234567890", Name = "Sam Kaul"
            };
            HttpRequestMessage request   = new HttpRequestMessage();
            MediaTypeFormatter formatter = new JsonMediaTypeFormatter();

            // The endpoint or route of the controller action.
            var httpResponse = await _client.PutAsync <UserService.Models.User>($"/api/user/{userId}", user, formatter);

            // Deserialize and examine results.
            var stringResponse = await httpResponse.Content.ReadAsStringAsync();

            Assert.Equal(HttpStatusCode.NotFound, httpResponse.StatusCode);
            Assert.Equal($"This user id does not exist", stringResponse);
        }
        public async Task RegisterUserShouldSuccess()
        {
            UserService.Models.User user = new UserService.Models.User {
                UserId = "Sam", Name = "Sam Gomes", Contact = "9876543210"
            };
            HttpRequestMessage request   = new HttpRequestMessage();
            MediaTypeFormatter formatter = new JsonMediaTypeFormatter();

            // The endpoint or route of the controller action.
            var httpResponse = await _client.PostAsync <UserService.Models.User>("/api/user", user, formatter);

            // Deserialize and examine results.
            var stringResponse = await httpResponse.Content.ReadAsStringAsync();

            var _user = JsonConvert.DeserializeObject <UserService.Models.User>(stringResponse);

            Assert.Equal(HttpStatusCode.Created, httpResponse.StatusCode);
            Assert.NotNull(_user);
            Assert.Equal("Sam Gomes", _user.Name);
        }
        public async Task UpdateUserShouldSuccess()
        {
            string userId = "Mukesh";

            UserService.Models.User user = new UserService.Models.User {
                UserId = "Mukesh", Contact = "1234567890", Name = "Mukesh Goel"
            };
            HttpRequestMessage request   = new HttpRequestMessage();
            MediaTypeFormatter formatter = new JsonMediaTypeFormatter();

            // The endpoint or route of the controller action.
            var httpResponse = await _client.PutAsync <UserService.Models.User>($"/api/user/{userId}", user, formatter);

            // Deserialize and examine results.
            var stringResponse = await httpResponse.Content.ReadAsStringAsync();

            var _user = JsonConvert.DeserializeObject <UserService.Models.User>(stringResponse);

            Assert.Equal(HttpStatusCode.OK, httpResponse.StatusCode);
            Assert.NotNull(_user);
            Assert.Equal("Mukesh Goel", _user.Name);
        }