Ejemplo n.º 1
0
        public void ParseIdProperty_AssignedId()
        {
            ClassInfo  clazz      = TestUtils.ParseHbm("BaseObject.hbm.xml", "BaseObject", ClassType.RootClass);
            IdProperty idProperty = clazz.GetIdProperty();

            idProperty.Should().NotBeNull();
            idProperty.Should()
            .HaveName("Id")
            .HaveTagName("Id")
            .HaveAttribute("type", "Int64")
            .HaveAttribute("generator", "assigned")
            .NotHaveAttribute("name");

            idProperty.GeneratorParams.Should().NotBeNull();

            idProperty.GeneratorParams.Should()
            .HaveName("assigned")
            .HaveTagName("generator");

            idProperty.GeneratorParams.Should().BeEmpty();
        }
Ejemplo n.º 2
0
        public void ParseIdProperty_ForeignColumn()
        {
            ClassInfo  clazz      = TestUtils.ParseHbm("Agency.hbm.xml", "HeadQuarter", ClassType.RootClass);
            IdProperty idProperty = clazz.GetIdProperty();

            idProperty.Should()
            .HaveName("Id")
            .HaveTagName("Id")
            .HaveAttribute("type", "Int64")
            .HaveAttribute("generator", "foreign");

            idProperty.GeneratorParams.Should()
            .HaveAttribute("property", "Agency");
        }