예제 #1
0
        public void WhenSetBasicColumnValuesThroughShortCutThenMergeColumn()
        {
            var member  = typeof(MyClass).GetProperty("Autoproperty");
            var mapping = new HbmProperty();
            var mapper  = new PropertyMapper(member, mapping);

            mapper.Column("pizza");
            mapper.Length(50);
            mapper.Precision(10);
            mapper.Scale(2);
            mapper.NotNullable(true);
            mapper.Unique(true);
            mapper.UniqueKey("AA");
            mapper.Index("II");

            Assert.That(mapping.Items, Is.Null);
            Assert.That(mapping.column, Is.EqualTo("pizza"));
            Assert.That(mapping.length, Is.EqualTo("50"));
            Assert.That(mapping.precision, Is.EqualTo("10"));
            Assert.That(mapping.scale, Is.EqualTo("2"));
            Assert.That(mapping.notnull, Is.EqualTo(true));
            Assert.That(mapping.unique, Is.EqualTo(true));
            Assert.That(mapping.uniquekey, Is.EqualTo("AA"));
            Assert.That(mapping.index, Is.EqualTo("II"));
        }
예제 #2
0
        public void WhenSetBasicColumnValuesThroughShortCutThenMergeColumn()
        {
            var member  = typeof(MyClass).GetProperty("Autoproperty");
            var mapping = new HbmProperty();
            var mapper  = new PropertyMapper(member, mapping);

            mapper.Column("pizza");
            mapper.Length(50);
            mapper.Precision(10);
            mapper.Scale(2);
            mapper.NotNullable(true);
            mapper.Unique(true);
            mapper.UniqueKey("AA");
            mapper.Index("II");

            mapping.Items.Should().Be.Null();
            mapping.column.Should().Be("pizza");
            mapping.length.Should().Be("50");
            mapping.precision.Should().Be("10");
            mapping.scale.Should().Be("2");
            mapping.notnull.Should().Be(true);
            mapping.unique.Should().Be(true);
            mapping.uniquekey.Should().Be("AA");
            mapping.index.Should().Be("II");
        }