Validate() function that run as part of BuildMapping ?
On Sat, Jan 31, 2009 at 7:32 AM, Tuna Toksoz <[email protected]> wrote:
> For issue 2.
>
> A Property/IValue needs some of(or many of) their props set, and yesterday
> I forget to set one of the properties of SimpleValue namely Table, leading
> to NullReference Exception.It cannot be seen until you create an object and
> save it against database.
>
> For issue 1:
> protected virtual Property CreateProperty(PersistentClass
> model,IValue value, PropertyInfo propInfo)
> {
> Property property = new Property
> {
> Name = propInfo.Name,
> PropertyAccessorName =
> mappings.DefaultAccess,
> Cascade = mappings.DefaultCascade,
> IsUpdateable = true,
> IsInsertable = true,
> IsOptimisticLocked = true,
> Generation =
> PropertyGeneration.Never,
> Value = value
> };
> return property;
> }
>
> As you see, I set some properties and in the test the only thing that I can
> do about it is (assuming the prop were public)
>
> Assert.That(prop.Name,Is.EqualTo("Age"));
> Assert.That(prop.Cascade,Is.EqualTo(true));
>
> etc. I wonder if there is a better way of doing it.
>
>
>
> Tuna Toksöz
> http://tunatoksoz.com
> http://twitter.com/tehlike
>
> Typos included to enhance the readers attention!
>
>
>
> On Sat, Jan 31, 2009 at 2:24 PM, Paul Batum <[email protected]> wrote:
>
>> I think it is a bit difficult to discuss without an example. Can you
>> illustrate the situation with some code?
>>
>> Paul Batum
>>
>>
>> On Sat, Jan 31, 2009 at 10:23 PM, Tuna Toksoz <[email protected]> wrote:
>>
>>> Hello,
>>>
>>> I managed to make it work for classes with no relations, but pure
>>> properties. However I haven't written tests for it because I am playing with
>>> ideas and was changing the design every 3 hours :)
>>> Now I guess I found something useful-if not perfect, and I wonder how
>>> should I test it? It is a very primitive operation, and testing it would
>>> mean almost writing the code double.
>>>
>>> I mean, I will set a prop on meta, and then check if it was set.
>>>
>>> Another issue is it is error prone, i may forget to set a prop, and it
>>> may not complain until I try to set. I have written one integration test but
>>> it is still hard to check if everything was correct.
>>>
>>> What do you guys think?
>>>
>>>
>>>
>>> Tuna Toksöz
>>> http://tunatoksoz.com
>>> http://twitter.com/tehlike
>>>
>>> Typos included to enhance the readers attention!
>>>
>>>
>>>
>>>
>>
>>
>>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Fluent NHibernate" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---