public void WhenSetInvalidTypeThenThrow() { var mapping = new HbmElement(); var mapper = new ElementMapper(typeof(string), mapping); Executing.This(() => mapper.Type(typeof(object), null)).Should().Throw <ArgumentOutOfRangeException>(); Executing.This(() => mapper.Type(null, null)).Should().Throw <ArgumentNullException>(); }
public void WhenSetInvalidTypeThenThrow() { var mapping = new HbmElement(); var mapper = new ElementMapper(typeof(string), mapping); ActionAssert.Throws <ArgumentOutOfRangeException>(() => mapper.Type(typeof(object), null)); ActionAssert.Throws <ArgumentNullException>(() => mapper.Type(null, null)); }
public void WhenSetTypeByNotFormalITypeThenSetTypeFullName() { var mapping = new HbmElement(); var mapper = new ElementMapper(typeof(string), mapping); mapper.Type <EnumStringType <MyEnum> >(); mapping.Type.name.Should().Contain(typeof(EnumStringType <MyEnum>).FullName); }
public void WhenSetTypeByITypeThenSetTypeName() { var mapping = new HbmElement(); var mapper = new ElementMapper(typeof(string), mapping); mapper.Type(NHibernateUtil.Int64); mapping.Type.name.Should().Be.EqualTo("Int64"); }
public void WhenSetTypeByICompositeUserTypeThenSetTypeName() { var mapping = new HbmElement(); var mapper = new ElementMapper(typeof(object), mapping); Assert.That(() => mapper.Type <MyCompoType>(), Throws.Nothing); Assert.That(mapping.Type.name, Does.Contain(nameof(MyCompoType))); Assert.That(mapping.type, Is.Null); }
public void WhenSetTypeByIUserTypeWithNullParamsThenSetTypeName() { var mapping = new HbmElement(); var mapper = new ElementMapper(typeof(string), mapping); mapper.Type <MyType>(null); mapping.Type.name.Should().Contain("MyType"); mapping.type.Should().Be.Null(); }
public void WhenSetTypeByIUserTypeWithParamsThenSetType() { var mapping = new HbmElement(); var mapper = new ElementMapper(typeof(string), mapping); mapper.Type <MyType>(new { Param1 = "a", Param2 = 12 }); mapping.type1.Should().Be.Null(); mapping.Type.name.Should().Contain("MyType"); mapping.Type.param.Should().Have.Count.EqualTo(2); mapping.Type.param.Select(p => p.name).Should().Have.SameValuesAs("Param1", "Param2"); mapping.Type.param.Select(p => p.GetText()).Should().Have.SameValuesAs("a", "12"); }
public void WhenSetMultiColumnsValuesThenAddColumns() { var mapping = new HbmElement(); var mapper = new ElementMapper(typeof(string), mapping); mapper.Type <MyType>(); mapper.Columns(cm => { cm.Name("column1"); cm.Length(50); }, cm => { cm.Name("column2"); cm.SqlType("VARCHAR(10)"); }); mapping.Columns.Should().Have.Count.EqualTo(2); }
public void WhenSetTypeByNotFormalITypeThenSetTypeFullName() { var mapping = new HbmElement(); var mapper = new ElementMapper(typeof(string), mapping); mapper.Type<EnumStringType<MyEnum>>(); mapping.Type.name.Should().Contain(typeof(EnumStringType<MyEnum>).FullName); }
public void WhenSetTypeByIUserTypeWithParamsThenSetType() { var mapping = new HbmElement(); var mapper = new ElementMapper(typeof(string), mapping); mapper.Type<MyType>(new { Param1 = "a", Param2 = 12 }); mapping.type1.Should().Be.Null(); mapping.Type.name.Should().Contain("MyType"); mapping.Type.param.Should().Have.Count.EqualTo(2); mapping.Type.param.Select(p => p.name).Should().Have.SameValuesAs("Param1", "Param2"); mapping.Type.param.Select(p => p.GetText()).Should().Have.SameValuesAs("a", "12"); }
public void WhenSetTypeByIUserTypeWithNullParamsThenSetTypeName() { var mapping = new HbmElement(); var mapper = new ElementMapper(typeof(string), mapping); mapper.Type<MyType>(null); mapping.Type.name.Should().Contain("MyType"); mapping.type.Should().Be.Null(); }
public void WhenSetMultiColumnsValuesThenAddColumns() { var mapping = new HbmElement(); var mapper = new ElementMapper(typeof(string), mapping); mapper.Type<MyType>(); mapper.Columns(cm => { cm.Name("column1"); cm.Length(50); }, cm => { cm.Name("column2"); cm.SqlType("VARCHAR(10)"); }); mapping.Columns.Should().Have.Count.EqualTo(2); }
public void WhenSetInvalidTypeThenThrow() { var mapping = new HbmElement(); var mapper = new ElementMapper(typeof(string), mapping); ActionAssert.Throws<ArgumentOutOfRangeException>(() => mapper.Type(typeof(object), null)); ActionAssert.Throws<ArgumentNullException>(() => mapper.Type(null, null)); }