Esempio n. 1
0
        public async void Test5()
        {
            var user2 = new REST_Api.ApiModels.Users
            {
                Id        = 1,
                FirstName = "Test",
                LastName  = "User",
                Email     = "*****@*****.**",
                Password  = "******",
            };
            var result1 = await _controller.PutToChangePasswordAsync(1, user2.Password);

            var goodRequestResult = Assert.IsType <OkObjectResult>(result1);
            //Assert.Same(Mapper.MapUsers(user2).ToString(), goodRequestResult.Value.ToString());


            var result2 = await _controller.PutToChangePasswordAsync(5, "1234");

            Assert.IsType <NotFoundObjectResult>(result2);
        }
Esempio n. 2
0
        public async void Test3()
        {
            var user2 = new REST_Api.ApiModels.Users
            {
                Id        = 2,
                FirstName = "Test3",
                LastName  = "User",
                Email     = "*****@*****.**",
                Password  = "******",
            };
            var result1 = await _controller.PostAsync(user2);

            Assert.IsType <OkObjectResult>(result1);


            user2.Email = "*****@*****.**";
            var result2 = await _controller.PostAsync(user2);

            Assert.IsType <BadRequestObjectResult>(result2);
        }
Esempio n. 3
0
        public async void Test4()
        {
            var user2 = new REST_Api.ApiModels.Users
            {
                Id        = 2,
                FirstName = "Test3",
                LastName  = "User",
                Email     = "*****@*****.**",
                Password  = "******",
            };
            var result1 = await _controller.Put(1, user2);

            var goodRequestResult = Assert.IsType <OkObjectResult>(result1);

            Assert.Same(Mapper.MapUsers(user2).ToString(), goodRequestResult.Value.ToString());

            var result2 = await _controller.Put(4, user2);

            Assert.IsType <NotFoundObjectResult>(result2);
        }