コード例 #1
0
        public async Task Get_ById_ShouldReturnOk()
        {
            //arrange 
            var userHandler = new UserRequestHandler(hostAddress);
            User user = TestDataHelper.GenerateUser();

            //act
            await userHandler.Create(user);

            HttpResponseMessage response = await userHandler.Get(user.Email);
            User resultUser = await response.Content.ReadAsAsync<User>();

            HttpResponseMessage resultResponse = await userHandler.Get(resultUser.Id.ToString());

            //assert
            Assert.IsTrue(resultResponse.IsSuccessStatusCode);
        }
コード例 #2
0
        public async Task Get_ByEmail_ShouldReturnOk()
        {
            //arrange 
            var userHandler = new UserRequestHandler(hostAddress);
            User user = TestDataHelper.GenerateUser();

            //act
            await userHandler.Create(user);
            HttpResponseMessage response = await userHandler.Get(user.Email);

            //assert
            Console.WriteLine(response.StatusCode);
            Assert.IsTrue(response.IsSuccessStatusCode);
        }
コード例 #3
0
        public async Task Get_ByEmail_ShouldReturnSameUser()
        {
            //arrange 
            var userHandler = new UserRequestHandler(hostAddress);
            User user = TestDataHelper.GenerateUser();

            //act
            await userHandler.Create(user);

            HttpResponseMessage response = await userHandler.Get(user.Email);
            User resultUser = await response.Content.ReadAsAsync<User>();

            //assert
            Assert.IsTrue(user.Email == resultUser.Email);
            Assert.IsTrue(user.FirstName == resultUser.FirstName);
            Assert.IsTrue(user.LastName == resultUser.LastName);
        }