public void TestValidationPerformedPositive()
        {
            var attr          = new RValidateAttribute();
            var actionContext = CreateContext();

            actionContext.ActionArguments.Add(
                "model",
                new SimpleModel
            {
                Key       = 1234,
                FirstName = "Uladzimir Harabtsou"
            });

            attr.OnActionExecuting(actionContext);
            Assert.IsTrue(actionContext.ModelState.IsValid);
            Assert.AreEqual(actionContext.ModelState.Count, 0);
            Assert.IsNull(actionContext.Response);
        }
        public void TestValidationPerformedNegative()
        {
            var attr          = new RValidateAttribute();
            var actionContext = CreateContext();

            actionContext.ActionArguments.Add(
                "model",
                new SimpleModel
            {
                Key       = 0,
                FirstName = "Uladzimir Harabtsou"
            });

            attr.OnActionExecuting(actionContext);
            Assert.IsFalse(actionContext.ModelState.IsValid);
            Assert.AreEqual(actionContext.ModelState.Count, 1);
            Assert.IsNotNull(actionContext.Response);
            Assert.AreEqual(actionContext.Response.StatusCode, HttpStatusCode.BadRequest);
        }