public void ComplexValueProperties_ValidModelItem_ReportValidState()
        {
            var item = new ValidatiableComplexPropertyObject()
            {
                Child = new ValidatiableScalarPropertyObject()
                {
                    NullableProperty       = null,
                    RangeProperty          = 7,
                    RequiredLengthProperty = "abc123",
                    RequiredProperty       = "b",
                },
                RangeValue = 33,
            };

            var generator = new ModelStateGenerator();

            var argumentToTest = CreateArgument("testItem", item);
            var dictionary     = generator.CreateStateDictionary(argumentToTest);

            Assert.IsTrue(dictionary.IsValid);
            Assert.AreEqual(1, dictionary.Count);
            Assert.IsTrue(dictionary.ContainsKey("testItem"));

            var entry = dictionary["testItem"];

            Assert.AreEqual(0, entry.Errors.Count);
        }
        public void ComplexValueProperties_InValidChildModelItem_ReportValidState()
        {
            // by default no children properties should checked. so even if rangedproperty is invalid its
            // not checked (requires custom attributes by the developer)
            var item = new ValidatiableComplexPropertyObject()
            {
                Child = new ValidatiableScalarPropertyObject()
                {
                    NullableProperty       = null,
                    RangeProperty          = -15, // out of range
                    RequiredLengthProperty = "abc123",
                    RequiredProperty       = "b",
                },
                RangeValue = 33,
            };
            var generator = new ModelStateGenerator();

            var argumentToTest = CreateArgument("testItem", item);
            var dictionary     = generator.CreateStateDictionary(argumentToTest);

            Assert.IsTrue(dictionary.IsValid);
            Assert.AreEqual(1, dictionary.Count);
            Assert.IsTrue(dictionary.ContainsKey("testItem"));
        }