Exemplo n.º 1
0
        public void Can_retrieve_set_validate_ReadOnly_flag()
        {
            var mappingItem = new AMappingItem();

            Assert.False(mappingItem.IsReadOnly);
            mappingItem.Modify();

            mappingItem.SetReadOnly();

            Assert.True(mappingItem.IsReadOnly);
            Assert.Equal(
                Strings.OperationOnReadOnlyItem,
                Assert.Throws <InvalidOperationException>(() => mappingItem.Modify())
                .Message);
        }
Exemplo n.º 2
0
        public void Can_retrieve_set_validate_ReadOnly_flag()
        {
            var mappingItem = new AMappingItem();

            Assert.False(mappingItem.IsReadOnly);
            Assert.DoesNotThrow(mappingItem.Modify);

            mappingItem.SetReadOnly();

            Assert.True(mappingItem.IsReadOnly);
            Assert.Equal(
                Strings.OperationOnReadOnlyItem,
                Assert.Throws<InvalidOperationException>(() => mappingItem.Modify())
                    .Message);
        }
Exemplo n.º 3
0
        public void Can_add_retrieve_remove_annotations()
        {
            var mappingItem = new AMappingItem();
            var annotation  = MetadataProperty.CreateAnnotation("N", "V");

            Assert.Equal(0, mappingItem.Annotations.Count);

            mappingItem.Annotations.Add(annotation);

            Assert.Equal(1, mappingItem.Annotations.Count);
            Assert.Same(annotation, mappingItem.Annotations[0]);

            mappingItem.Annotations.Remove(annotation);

            Assert.Equal(0, mappingItem.Annotations.Count);
        }
Exemplo n.º 4
0
        public void Can_add_retrieve_remove_annotations()
        {
            var mappingItem = new AMappingItem();
            var annotation = MetadataProperty.CreateAnnotation("N", "V");

            Assert.Equal(0, mappingItem.Annotations.Count);

            mappingItem.Annotations.Add(annotation);

            Assert.Equal(1, mappingItem.Annotations.Count);
            Assert.Same(annotation, mappingItem.Annotations[0]);

            mappingItem.Annotations.Remove(annotation);

            Assert.Equal(0, mappingItem.Annotations.Count);
        }