Exemple #1
0
        public void TestValidArgument()
        {
            MethodInfo       method   = typeof(ValidationTarget).GetMethod("Save");
            Inventor         inventor = new Inventor("Nikola Tesla", new DateTime(1856, 7, 9), "Serbian");
            ValidationTarget target   = new ValidationTarget();

            object[] args = new object[] { inventor };

            ExpectValidatorRetrieval("required", requiredValidator);

            advice.Before(method, args, target);
            method.Invoke(target, args);
            Assert.AreEqual("NIKOLA TESLA", inventor.Name);
        }
        public void TestValidArgument()
        {
            MethodInfo method = typeof(ValidationTarget).GetMethod("Save");
            Inventor inventor = new Inventor("Nikola Tesla", new DateTime(1856, 7, 9), "Serbian");
            ValidationTarget target = new ValidationTarget();
            object[] args = new object[] {inventor};

            using (mocks.Record())
            {
                ExpectValidatorRetrieval("required", requiredValidator);
            }

            using (mocks.Playback())
            {
                advice.Before(method, args, target);
                method.Invoke(target, args);
                Assert.AreEqual("NIKOLA TESLA", inventor.Name);
            }

        }