Beispiel #1
0
        public void ApplyNestedProperty_ThrowsODataException_WhenPatchingCollectionNavigationProperty()
        {
            // Arrange
            var deserializer = new ODataResourceDeserializer(_deserializerProvider);
            ODataNestedResourceInfoWrapper resourceInfoWrapper = new ODataNestedResourceInfoWrapper(new ODataNestedResourceInfo {
                Name = "Products"
            });

            resourceInfoWrapper.NestedItems.Add(new ODataResourceSetWrapper(new ODataResourceSet()));
            _readContext.ResourceType = typeof(Delta <Supplier>);

            // Act & Assert
            Assert.Throws <ODataException>(
                () => deserializer.ApplyNestedProperty(42, resourceInfoWrapper, _supplierEdmType, _readContext),
                "Cannot apply PATCH to navigation property 'Products' on entity type 'ODataDemo.Supplier'.");
        }