Ejemplo n.º 1
0
        public void NotRegister()
        {
            var conf = new Configuration().Configure();
            IAuditableMetaDataStore store = new MappingAuditableMetaDataStore(conf);

            store.RegisterAuditableEntityIfNeeded("NotExists").Should().Be.False();
            store.GetAuditableMetaData("NotExists").Should().Be.Null();
            store.Contains("NotExists").Should().Be.False();

            store.RegisterAuditableEntityIfNeeded(string.Empty).Should().Be.False();
            store.GetAuditableMetaData(string.Empty).Should().Be.Null();
            store.Contains(string.Empty).Should().Be.False();
        }
Ejemplo n.º 2
0
        public void CanRegister()
        {
            var conf = new Configuration().Configure();

            conf.AddResource("uNhAddIns.Test.Audit.Simple.hbm.xml", GetType().Assembly);
            IAuditableMetaDataStore store = new MappingAuditableMetaDataStore(conf);

            store.RegisterAuditableEntityIfNeeded(EntityNameSimple).Should().Be.True();
            store.GetAuditableMetaData(EntityNameSimple).Should().Not.Be.Null();
            store.Contains(EntityNameSimple).Should().Be.True();
        }
Ejemplo n.º 3
0
        public void CanRegisterOlySubClasses()
        {
            var conf = new Configuration().Configure();

            conf.AddResource("uNhAddIns.Test.Audit.Address.hbm.xml", GetType().Assembly);
            conf.AddResource("uNhAddIns.Test.Audit.Person.hbm.xml", GetType().Assembly);
            conf.AddResource("uNhAddIns.Test.Audit.Animal.hbm.xml", GetType().Assembly);
            IAuditableMetaDataStore store = new MappingAuditableMetaDataStore(conf);

            foreach (var s in conf.ClassMappings.Select(cm => cm.EntityName))
            {
                store.RegisterAuditableEntityIfNeeded(s);
            }

            store.Contains(typeof(Animal).FullName).Should().Be.False();
            store.Contains(typeof(Reptile).FullName).Should().Be.False();
            store.Contains(typeof(Lizard).FullName).Should().Be.False();
            store.Contains(typeof(Mammal).FullName).Should().Be.False();
            store.Contains(typeof(DomesticAnimal).FullName).Should().Be.True();
            store.Contains(typeof(Cat).FullName).Should().Be.True();
            store.Contains(typeof(Dog).FullName).Should().Be.True();
        }