Search code examples
c#.netnbuilder

With NBuilder for .NET, what's the difference between .Has(..) and .Have(..)?


NBuilder has two of the following fluent methods

.Has(..)
.Have(..)

eg.

return Builder<User>.CreateListOfSize(100)
    .WhereTheFirst(1)
        .Has(x => x.FirstName = "Jon Skeet")
    .Build();

return Builder<User>.CreateListOfSize(100)
    .WhereTheFirst(1)
        .Have(x => x.FirstName = "Jon Skeet")
    .Build();

I don't understand the difference? Can someone please explain why I would do a Have instead of Has .. or vice versa?


Solution

  • They are identical. Full source code here.

    Has:

        [Obsolete(Messages.NewSyntax_UseWith)]
        public static IOperable<T> Has<T, TFunc>(this IOperable<T> operable, Func<T, TFunc> func)
        {
            return With(operable, func);
        }
    

    Have:

        [Obsolete(Messages.NewSyntax_UseWith)]
        public static IOperable<T> Have<T, TFunc>(this IOperable<T> operable, Func<T, TFunc> func)
        {
            return With(operable, func);
        }