示例#1
0
        public void GetCollectionForRecordWorks()
        {
            // Arrange
            IEdmRecordExpression record = new EdmRecordExpression(
                new EdmPropertyConstructor("prop", new EdmCollectionExpression(
                                               new EdmRecordExpression(
                                                   new EdmPropertyConstructor("Scope", new EdmStringConstant("scope1")),
                                                   new EdmPropertyConstructor("RestrictedProperties", new EdmStringConstant("restrictedProperties1"))),
                                               new EdmRecordExpression(
                                                   new EdmPropertyConstructor("Scope", new EdmStringConstant("scope2")),
                                                   new EdmPropertyConstructor("RestrictedProperties", new EdmStringConstant("restrictedProperties2"))))));

            // Act
            IList <ScopeType> actual = record.GetCollection <ScopeType>("prop");

            // Assert
            Assert.NotNull(actual);
            Assert.Equal(2, actual.Count);

            for (int i = 1; i <= actual.Count; i++)
            {
                Assert.Equal("scope" + i, actual[i - 1].Scope);
                Assert.Equal("restrictedProperties" + i, actual[i - 1].RestrictedProperties);
            }
        }
示例#2
0
        public void GetCollectionForStringWorks()
        {
            // Arrange
            IEdmRecordExpression record = new EdmRecordExpression(
                new EdmPropertyConstructor("prop", new EdmCollectionExpression(
                                               new EdmStringConstant("abc"), new EdmStringConstant("xyz"))));

            // Act
            IList <string> actual = record.GetCollection("prop");

            // Assert
            Assert.NotNull(actual);
            Assert.Equal(2, actual.Count);
            Assert.Equal(new[] { "abc", "xyz" }, actual);
        }