private void IsValidReturnsFalseWhenRequiredPropertyIsNullEquivalent(string missingValue)
        {
            // Arrange
            var r = new WhenRequiredRule("ARequiredRule").Property("Name").Equals("George").Then().Required("State");
            Dictionary <string, string> Values = new Dictionary <string, string>()
            {
                { "Name", "George" },
                { "State", missingValue }
            };

            // Act
            var result = r.IsValid(Values);

            // Assert
            Assert.IsFalse(result);
            Assert.AreEqual("The following properties are required but not provided: State", r.ErrorMessage);
        }
        public void IsValidReturnsTrue()
        {
            // Arrange
            var r = new WhenRequiredRule("ARequiredRule").Property("Name").Equals("George").Then().Required("State");
            Dictionary <string, string> Values = new Dictionary <string, string>()
            {
                { "Name", "George" },
                { "State", "This is not null" }
            };

            // Act
            var result = r.IsValid(Values);

            // Assert
            Assert.IsTrue(result);
            Assert.IsNull(r.ErrorMessage);
        }
        public void IsValidReturnsFalseWhenMultiplePropertiesAreTestedAndOneFails()
        {
            // Arrange
            var r = new WhenRequiredRule("ARequiredRule").Property("FirstName").Equals("George").Then().Required("State").Required("LastName");
            Dictionary <string, string> Values = new Dictionary <string, string>()
            {
                { "FirstName", "George" },
                { "LastName", null },
                { "State", "This is also not null" }
            };

            // Act
            var result = r.IsValid(Values);

            // Assert
            Assert.IsFalse(result);
            Assert.AreEqual("The following properties are required but not provided: LastName", r.ErrorMessage);
        }