示例#1
0
        public void GetConcurrencyProperties_CachesCollection(string entitySetName)
        {
            // Arrange
            ODataConventionModelBuilder builder = ODataConventionModelBuilderFactory.Create();

            builder.EntitySet <TypeWithoutConcurrencyProperties>("WithoutCP");
            builder.EntitySet <TypeWithConcurrencyProperties>("WithCP");
            IEdmModel model = builder.GetEdmModel();

            IEdmEntitySet entitySet = model.EntityContainer.FindEntitySet(entitySetName);

            // Act
            var first  = EdmLibHelpers.GetConcurrencyProperties(model, entitySet);
            var second = EdmLibHelpers.GetConcurrencyProperties(model, entitySet);

            // Assert
            Assert.Same(first, second);
        }
示例#2
0
        public void ConcurrencyPropertiesAnnotation_NotSerializedToMetadata(string entitySetName)
        {
            // Arrange
            ODataConventionModelBuilder builder = ODataConventionModelBuilderFactory.Create();

            builder.EntitySet <TypeWithoutConcurrencyProperties>("WithoutCP");
            builder.EntitySet <TypeWithConcurrencyProperties>("WithCP");
            IEdmModel model            = builder.GetEdmModel();
            string    originalMetadata = MetadataTest.GetCSDL(model);

            IEdmEntitySet entitySet = model.EntityContainer.FindEntitySet(entitySetName);

            // Act
            EdmLibHelpers.GetConcurrencyProperties(model, entitySet);
            string actualMetadata = MetadataTest.GetCSDL(model);

            // Assert
            Assert.Equal(originalMetadata, actualMetadata);
        }