コード例 #1
0
        public void MetadataWithUserImplementation()
        {
            Client2 client =
                new Client2("Bill", new LocalDate(2000, 04, 25))
                .SetMetadata(new EntityMetadata("Database"))
                .SetMetadata("AttachedProperty", 42);

            var entityMetadata = client.GetMetadata <EntityMetadata>();

            entityMetadata.Should().NotBeNull();
            entityMetadata.Source.Should().Be("Database");

            client.GetMetadata <int>("AttachedProperty").Should().Be(42);

            // Get metadata for client
            IPropertyContainer metadata = client.Metadata;

            metadata.Properties.Count.Should().Be(2);

            IPropertyContainer propertyContainer = client.FreezeMetadata();

            propertyContainer.Should().BeOfType <PropertyContainer>();
        }