Ejemplo n.º 1
0
        public async Task DefineEnumPropertyTest_Autodefinition()
        {
            var store = await StoreBuilder.New().CreateAsync();

            var schema = await store.Schemas.New <TestDomainDefinition>().CreateAsync();

            var domain = await store.DomainModels.New().CreateAsync("Test") as IUpdatableDomainModel;

            using (var s = store.BeginSession())
            {
                ISchemaEntity metadata = schema.Definition.XExtendsBaseClass;
                var           prop     = metadata.DefineProperty <ETest>("enum");

                IModelElement a = new XExtendsBaseClass(domain);

                var pv = domain.GetPropertyValue(a.Id, prop);
                Assert.Equal(0, pv.CurrentVersion);
                Assert.Equal(ETest.A, pv.Value);

                domain.SetPropertyValue(a, prop, ETest.B);
                pv = domain.GetPropertyValue(a.Id, prop);
                Assert.NotEqual(0, pv.CurrentVersion);
                Assert.Equal(ETest.B, pv.Value);
                s.AcceptChanges();
            }
        }