2013-03-27 23:54:01 -07:00
|
|
|
using System.Collections.Generic;
|
2013-03-27 23:49:38 -07:00
|
|
|
using System.Linq;
|
|
|
|
using FizzWare.NBuilder;
|
|
|
|
using NzbDrone.Core.Datastore;
|
|
|
|
|
2013-03-27 23:54:01 -07:00
|
|
|
namespace NzbDrone.Core.Test.Framework
|
2013-03-27 23:49:38 -07:00
|
|
|
{
|
|
|
|
public static class NBuilderExtensions
|
|
|
|
{
|
|
|
|
public static T BuildNew<T>(this ISingleObjectBuilder<T> builder) where T : ModelBase, new()
|
|
|
|
{
|
|
|
|
return builder.With(c => c.Id = 0).Build();
|
|
|
|
}
|
|
|
|
|
2013-03-31 19:43:58 -07:00
|
|
|
public static List<T> BuildList<T>(this IListBuilder<T> builder) where T : ModelBase, new()
|
2013-03-27 23:49:38 -07:00
|
|
|
{
|
|
|
|
return builder.Build().ToList();
|
|
|
|
}
|
|
|
|
|
2013-03-31 19:43:58 -07:00
|
|
|
public static List<T> BuildListOfNew<T>(this IListBuilder<T> builder) where T : ModelBase, new()
|
2013-03-27 23:49:38 -07:00
|
|
|
{
|
|
|
|
return BuildList<T>(builder.All().With(c => c.Id = 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|