public void GetProperty_Throws_ODataException_If_PropertyNameNotFound()
        {
            TestHelper.EnsureEDM();

            EdmComplexType edmComplexType = EntityDataModel.Current.EntitySets["Customers"].EdmType;

            ODataException odataException = Assert.Throws <ODataException>(() => edmComplexType.GetProperty("Name"));

            Assert.Equal(ExceptionMessage.EdmTypeDoesNotContainProperty("Sample.Model.Customer", "Name"), odataException.Message);
            Assert.Equal(HttpStatusCode.BadRequest, odataException.StatusCode);
            Assert.Equal("Sample.Model.Customer", odataException.Target);
        }
        /// <summary>
        /// Gets the <see cref="EdmProperty"/> declared in this type with the specified name.
        /// </summary>
        /// <param name="name">The name of the property.</param>
        /// <returns>The <see cref="EdmProperty"/> declared in this type with the specified name.</returns>
        /// <exception cref="ODataException">The type does not contain a property with the specified name.</exception>
        public EdmProperty GetProperty(string name)
        {
            for (int i = 0; i < Properties.Count; i++)
            {
                EdmProperty property = Properties[i];

                if (property.Name.Equals(name, StringComparison.Ordinal))
                {
                    return(property);
                }
            }

            throw ODataException.BadRequest(ExceptionMessage.EdmTypeDoesNotContainProperty(FullName, name), FullName);
        }