Ejemplo n.º 1
0
        public async Task PutUser_ValidInput_Success()
        {
            _context.Functions.AddRange(new List <Function>()
            {
                new Function()
                {
                    Id        = "PutUser_ValidInput_Success",
                    ParentId  = null,
                    Name      = "PutUser_ValidInput_Success",
                    SortOrder = 1,
                    Url       = "/PutUser_ValidInput_Success"
                }
            });
            await _context.SaveChangesAsync();

            var functionsController = new FunctionsController(_context);
            var result = await functionsController.PutFunction("PutUser_ValidInput_Success", new FunctionCreateRequest()
            {
                ParentId  = null,
                Name      = "PutUser_ValidInput_Success updated",
                SortOrder = 6,
                Url       = "/PutUser_ValidInput_Success"
            });

            Assert.IsType <NoContentResult>(result);
        }
Ejemplo n.º 2
0
        public async Task PutFunction_ValidInput_Success()
        {
            _localizer    = MockLocalizer();
            _returnString = MockString();
            _context.Functions.AddRange(new List <Function>()
            {
                new Function()
                {
                    Id        = "PutUser_ValidInput_Success",
                    ParentId  = null,
                    NameTemp  = "PutUser_ValidInput_Success",
                    SortOrder = 1,
                    Url       = "/PutUser_ValidInput_Success"
                }
            });
            await _context.SaveChangesAsync();

            var controller = new FunctionsController(_context, _mockLogger.Object, _mapper, _localizer, _returnString);
            var result     = await controller.PutFunction("PutUser_ValidInput_Success", new FunctionCreateRequest()
            {
                ParentId  = null,
                NameTemp  = "PutUser_ValidInput_Success updated",
                SortOrder = 6,
                Url       = "/PutUser_ValidInput_Success"
            });

            Assert.IsType <NoContentResult>(result);
        }
Ejemplo n.º 3
0
        public async Task PutUser_ValidInput_Failed()
        {
            var functionsController = new FunctionsController(_context);

            var result = await functionsController.PutFunction("PutUser_ValidInput_Failed", new FunctionCreateRequest()
            {
                ParentId  = null,
                Name      = "PutUser_ValidInput_Failed update",
                SortOrder = 6,
                Url       = "/PutUser_ValidInput_Failed"
            });

            Assert.IsType <NotFoundObjectResult>(result);
        }
Ejemplo n.º 4
0
        public async Task PutFunction_ValidInput_Failed()
        {
            _localizer    = MockLocalizer();
            _returnString = MockString();
            var controller = new FunctionsController(_context, _mockLogger.Object, _mapper, _localizer, _returnString);

            var result = await controller.PutFunction("PutUser_ValidInput_Failed", new FunctionCreateRequest()
            {
                ParentId  = null,
                NameTemp  = "PutUser_ValidInput_Failed update",
                SortOrder = 6,
                Url       = "/PutUser_ValidInput_Failed"
            });

            Assert.IsType <NotFoundObjectResult>(result);
        }