Пример #1
0
        public void ValidateBeerIdAttribute_MissingBeerId_ReturnBadRequestTest()
        {
            var filter = new ValidateBeerIdAttribute();
            var actionExecutingContext = GetActionExecutingContext();

            filter.OnActionExecuting(actionExecutingContext);
            Assert.IsType <BadRequestObjectResult>(actionExecutingContext.Result);
        }
Пример #2
0
        public void ValidateBeerIdAttribute_InvalidBeerId_ReturnBadRequestTest()
        {
            var filter = new ValidateBeerIdAttribute();

            var actionExecutingContext = GetActionExecutingContext();

            actionExecutingContext.ActionArguments.Add("id", 5000);
            filter.OnActionExecuting(actionExecutingContext);
            Assert.IsType <BadRequestObjectResult>(actionExecutingContext.Result);
        }