public void WhenSetInvalidTypeThenThrow() { var hbmId = new HbmId(); var mapper = new IdMapper(null, hbmId); Assert.That(() => mapper.Type(typeof(object), null), Throws.TypeOf <ArgumentOutOfRangeException>()); Assert.That(() => mapper.Type(null, null), Throws.TypeOf <ArgumentNullException>()); }
public void WhenSetTypeByITypeThenSetTypeName() { var hbmId = new HbmId(); var mapper = new IdMapper(null, hbmId); mapper.Type(NHibernateUtil.String); Assert.That(hbmId.Type.name, Is.EqualTo("String")); }
public void WhenSetTypeByITypeTypeThenSetType() { var hbmId = new HbmId(); var mapper = new IdMapper(null, hbmId); mapper.Type <EnumStringType <MyEnum> >(); Assert.That(hbmId.Type.name, Does.Contain(typeof(EnumStringType <MyEnum>).FullName)); Assert.That(hbmId.type, Is.Null); }
public void WhenSetTypeByIUserTypeWithNullParamsThenSetTypeName() { var hbmId = new HbmId(); var mapper = new IdMapper(null, hbmId); mapper.Type <MyType>(null); Assert.That(hbmId.Type.name, Does.Contain("MyType")); Assert.That(hbmId.type, Is.Null); }
public void WhenSetTypeByICompositeUserTypeThenSetTypeName() { var hbmId = new HbmId(); var mapper = new IdMapper(null, hbmId); mapper.Type <MyCompoType>(); Assert.That(hbmId.Type.name, Does.Contain("MyCompoType")); Assert.That(hbmId.type, Is.Null); }
public void WhenSetTypeByIUserTypeWithParamsThenSetType() { var hbmId = new HbmId(); var mapper = new IdMapper(null, hbmId); mapper.Type <MyType>(new { Param1 = "a", Param2 = 12 }); Assert.That(hbmId.type1, Is.Null); Assert.That(hbmId.Type.name, Does.Contain("MyType")); Assert.That(hbmId.Type.param, Has.Length.EqualTo(2)); Assert.That(hbmId.Type.param.Select(p => p.name), Is.EquivalentTo(new [] { "Param1", "Param2" })); Assert.That(hbmId.Type.param.Select(p => p.GetText()), Is.EquivalentTo(new [] { "a", "12" })); }