public void Test_Update_InvalidEntityMustNotUpdate()
        {
            // Create the mock entity
            MockRequiredEntity entity = new MockRequiredEntity();

            entity.TestProperty = "Test1";

            entity.Validator = new ValidateStrategy();


            // Save the entity
            SaveStrategy.New(entity, false).Save(entity);

            // Set the required property to empty
            entity.TestProperty = "";

            Assert.IsFalse(entity.IsValid, "The validator returned true when it should return false.");

            // Update the invalid entity
            bool isValid = UpdateStrategy.New(entity, false).Update(entity);

            Assert.IsFalse(isValid, "The update strategy didn't recognise the entity as invalid.");

            MockRequiredEntity foundEntity = RetrieveStrategy.New <MockRequiredEntity>(false).Retrieve <MockRequiredEntity>("ID", entity.ID);

            Assert.IsNotNull(foundEntity);

            Assert.AreNotEqual(foundEntity.TestProperty, entity.TestProperty, "The entity was updated despite being invalid.");
        }
        public void Test_IsValid_False_String()
        {
            MockRequiredEntity entity = new MockRequiredEntity();

            ValidateRequiredStrategy strategy = new ValidateRequiredStrategy();

            PropertyInfo property = entity.GetType().GetProperty("TestProperty");

            object[] objs = property.GetCustomAttributes(typeof(RequiredAttribute), true);

            IValidatePropertyAttribute attribute = (IValidatePropertyAttribute)objs[0];

            bool isValid = strategy.IsValid(entity, property, attribute);

            Assert.IsFalse(isValid, "Returned true when it should have been false.");
        }