Ejemplo n.º 1
0
        public void CreateStoreItemCollection_creates_StoreItemCollection_for_valid_ssdl_and_targetFrameworkVersion()
        {
            IList <EdmSchemaError> schemaErrors;
            var storeItemCollection =
                EdmExtension.CreateStoreItemCollection(
                    Ssdl,
                    new Version(3, 0, 0, 0),
                    resolver,
                    out schemaErrors);

            Assert.NotNull(storeItemCollection);
            Assert.Equal(0, schemaErrors.Count);
            Assert.NotNull(storeItemCollection.GetItem <EntityType>("AdventureWorksModel.Store.Entities"));
        }
Ejemplo n.º 2
0
        public void CreateStoreItemCollection_throws_ArgumentException_for_incorrect_targetFrameworkVersion()
        {
            IList <EdmSchemaError> schemaErrors;

            var exception = Assert.Throws <ArgumentException>(
                () => EdmExtension.CreateStoreItemCollection(
                    string.Empty,
                    new Version(0, 0),
                    null,
                    out schemaErrors));

            Assert.Equal("targetFrameworkVersion", exception.ParamName);
            Assert.True(
                exception.Message.StartsWith(
                    string.Format(CultureInfo.CurrentCulture, Resources.ErrorNonValidTargetVersion, "0.0")));
        }
Ejemplo n.º 3
0
        public void CreateStoreItemCollection_returns_errors_StoreItemCollections_for_invalid_ssdl()
        {
            var invalidSsdl = XDocument.Parse(Ssdl);

            invalidSsdl.Descendants("{http://schemas.microsoft.com/ado/2009/11/edm/ssdl}" + "PropertyRef").Remove();

            IList <EdmSchemaError> schemaErrors;
            var storeItemCollection = EdmExtension.CreateStoreItemCollection(
                invalidSsdl.ToString(),
                new Version(3, 0, 0, 0),
                resolver,
                out schemaErrors);

            Assert.Null(storeItemCollection);
            Assert.Equal(1, schemaErrors.Count);
            Assert.Contains("'PropertyRef'", schemaErrors[0].Message);
        }