public void WhenCreateThenHasDefaultTypeAndGenerator() { var hbmId = new HbmCollectionId(); new CollectionIdMapper(hbmId); [email protected]().Not.Be.NullOrEmpty(); hbmId.type.Should().Not.Be.NullOrEmpty(); }
public void WhenCreateThenHasDefaultTypeAndGenerator() { var hbmId = new HbmCollectionId(); new CollectionIdMapper(hbmId); Assert.That(hbmId.generator.@class, Is.Not.Null.And.Not.Empty); Assert.That(hbmId.type, Is.Not.Null.And.Not.Empty); }
public void WhenSetGeneratorThenChangeType() { var hbmId = new HbmCollectionId(); new CollectionIdMapper(hbmId).Generator(Generators.HighLow); Assert.That(hbmId.generator.@class, Is.EqualTo("hilo")); Assert.That(hbmId.type.ToLowerInvariant(), Is.StringContaining("int")); }
public void WhenSetGeneratorThenChangeType() { var hbmId = new HbmCollectionId(); new CollectionIdMapper(hbmId).Generator(Generators.HighLow); [email protected]().Be.EqualTo("hilo"); hbmId.type.ToLowerInvariant().Should().Contain("int"); }
public void CanSetGeneratorWithParameters() { var hbmId = new HbmCollectionId(); new CollectionIdMapper(hbmId).Generator(Generators.HighLow, p => p.Params(new { max_low = 99, where = "TableName" })); [email protected]().Be.EqualTo("hilo"); hbmId.generator.param.Should().Have.Count.EqualTo(2); hbmId.generator.param.Select(p => p.name).Should().Have.SameValuesAs("max_low", "where"); hbmId.generator.param.Select(p => p.GetText()).Should().Have.SameValuesAs("99", "TableName"); }
public void CanSetGeneratorWithParameters() { var hbmId = new HbmCollectionId(); new CollectionIdMapper(hbmId).Generator(Generators.HighLow, p => p.Params(new { max_low = 99, where = "TableName" })); Assert.That(hbmId.generator.@class, Is.EqualTo("hilo")); Assert.That(hbmId.generator.param, Has.Length.EqualTo(2)); Assert.That(hbmId.generator.param.Select(p => p.name), Is.EquivalentTo(new [] {"max_low", "where"})); Assert.That(hbmId.generator.param.Select(p => p.GetText()), Is.EquivalentTo(new [] {"99", "TableName"})); }
public void WhenForceTypeThenNotChangeType() { var hbmId = new HbmCollectionId(); var collectionIdMapper = new CollectionIdMapper(hbmId); collectionIdMapper.Type((IIdentifierType) NHibernateUtil.Int64); collectionIdMapper.Generator(Generators.HighLow); Assert.That(hbmId.generator.@class, Is.EqualTo("hilo")); Assert.That(hbmId.type, Is.EqualTo("Int64")); }
public void CanSetLength() { var hbmId = new HbmCollectionId(); var mapper = new CollectionIdMapper(hbmId); mapper.Length(10); hbmId.length.Should().Be("10"); }
public CollectionIdMapper(HbmCollectionId hbmId) { this.hbmId = hbmId; this.hbmId.column1 = DefaultColumnName; Generator(Generators.Guid); }
public void CanSetGeneratorIdentity() { var hbmId = new HbmCollectionId(); new CollectionIdMapper(hbmId).Generator(Generators.Identity); Assert.That(hbmId.generator.@class, Is.EqualTo("identity")); }
public void CanSetGeneratorGuidComb() { var hbmId = new HbmCollectionId(); new CollectionIdMapper(hbmId).Generator(Generators.GuidComb); Assert.That(hbmId.generator.@class, Is.EqualTo("guid.comb")); }
public void CanSetGeneratorSequence() { var hbmId = new HbmCollectionId(); new CollectionIdMapper(hbmId).Generator(Generators.Sequence); [email protected]().Be.EqualTo("sequence"); }
public void CanSetGeneratorGuidComb() { var hbmId = new HbmCollectionId(); new CollectionIdMapper(hbmId).Generator(Generators.GuidComb); [email protected]().Be.EqualTo("guid.comb"); }
public void CanSetGenerator() { var hbmId = new HbmCollectionId(); new CollectionIdMapper(hbmId).Generator(Generators.HighLow); [email protected]().Be.EqualTo("hilo"); }
public void CanSetGenerator() { var hbmId = new HbmCollectionId(); new CollectionIdMapper(hbmId).Generator(Generators.HighLow); Assert.That(hbmId.generator.@class, Is.EqualTo("hilo")); }
public void CanSetGeneratorIdentity() { var hbmId = new HbmCollectionId(); new CollectionIdMapper(hbmId).Generator(Generators.Identity); [email protected]().Be.EqualTo("identity"); }
public void CantSetGeneratorAssigned() { var hbmId = new HbmCollectionId(); var collectionIdMapper = new CollectionIdMapper(hbmId); collectionIdMapper.Executing(x=> x.Generator(Generators.Assigned)).Throws<NotSupportedException>(); }
public void CanSetGeneratorSequence() { var hbmId = new HbmCollectionId(); new CollectionIdMapper(hbmId).Generator(Generators.Sequence); Assert.That(hbmId.generator.@class, Is.EqualTo("sequence")); }
public void CanSetColumnName() { var hbmId = new HbmCollectionId(); var mapper = new CollectionIdMapper(hbmId); mapper.Column("MyName"); Assert.That(hbmId.Columns.Single().name, Is.EqualTo("MyName")); }
public void CantSetGeneratorAssigned() { var hbmId = new HbmCollectionId(); var collectionIdMapper = new CollectionIdMapper(hbmId); Assert.That(() => collectionIdMapper.Generator(Generators.Assigned), Throws.TypeOf<NotSupportedException>()); }
public void CanSetLength() { var hbmId = new HbmCollectionId(); var mapper = new CollectionIdMapper(hbmId); mapper.Length(10); Assert.That(hbmId.length, Is.EqualTo("10")); }
public void BindSimpleValue(HbmCollectionId collectionIdMapping, string propertyPath) { new TypeBinder(value, Mappings).Bind(collectionIdMapping.Type); new ColumnsBinder(value, Mappings).Bind(collectionIdMapping.Columns, false, () => new HbmColumn { name = mappings.NamingStrategy.PropertyToColumnName(propertyPath), length = collectionIdMapping.length, }); }
public void CanSetColumnName() { var hbmId = new HbmCollectionId(); var mapper = new CollectionIdMapper(hbmId); mapper.Column("MyName"); hbmId.Columns.Single().name.Should().Be("MyName"); }