public void TestValidateWithException()
        {
            var s1f = new Simple1Field();
            var v   = new Core.Validator();

            Assert.Throws <ValidationException>(() => v.CheckObject(s1f));
        }
        public void TestScanForSingleField()
        {
            var obj = new Simple1Field();
            var ts  = new TypeScanner(obj.GetType());
            ValidationUnitCollection vc = ts.Scan();

            Assert.AreEqual(1, vc.Count, "Wrong Number of Attributes scanned");
            Assert.That(((SingleValidatorValidationUnit)vc[0]).Validator, Is.InstanceOf(typeof(RequiredValidator)), "Wrong Attribute Type");
        }
        public void TestWrongObject()
        {
            var s1f = new Simple1Field();
            var v   = new Core.Validator();
            ValidationResult res = v.ValidateObject(s1f);

            Assert.IsFalse(res, "Object does not validate well");
            Assert.AreEqual(1, res.ErrorMessages.Count, "Wrong number of error detected");
            Assert.AreEqual(cSimpleErrorMessage, res.ErrorMessages[0]);
        }
        public void TestGoodObject()
        {
            var s1f = new Simple1Field();

            s1f.field = "value";
            var v = new Core.Validator();
            ValidationResult res = v.ValidateObject(s1f);

            Assert.IsTrue(res, "Object does not validate well");
        }
		public void TestScanForSingleFieldRepeateScanner()
		{
			var obj = new Simple1Field();
			var ts = new TypeScanner(obj.GetType());
			ValidationUnitCollection vc = ts.Scan();
			Assert.AreEqual(1, vc.Count, "Wrong Number of Attributes scanned");
			Assert.That(((SingleValidatorValidationUnit)vc[0]).Validator, Is.InstanceOf(typeof(RequiredValidator)), "Wrong Attribute Type");
			ValidationUnitCollection anotherscan = ts.Scan();
			Assert.AreEqual(1, anotherscan.Count, "Wrong Number of Attributes scanned");
			Assert.That(((SingleValidatorValidationUnit)anotherscan[0]).Validator, Is.InstanceOf(typeof(RequiredValidator)), "Wrong Attribute Type");
		}
		public void TestWrongObject()
		{
			var s1f = new Simple1Field();
			var v = new Core.Validator();
			ValidationResult res = v.ValidateObject(s1f);
			Assert.IsFalse(res, "Object does not validate well");
			Assert.AreEqual(1, res.ErrorMessages.Count, "Wrong number of error detected");
			Assert.AreEqual(cSimpleErrorMessage, res.ErrorMessages[0]);
		}
		public void TestValidateWithException()
		{
			var s1f = new Simple1Field();
			var v = new Core.Validator();
			Assert.Throws<ValidationException>(() => v.CheckObject(s1f));
		}
		public void TestGoodObject()
		{
			var s1f = new Simple1Field();
			s1f.field = "value";
			var v = new Core.Validator();
			ValidationResult res = v.ValidateObject(s1f);
			Assert.IsTrue(res, "Object does not validate well");
		}