Radarr/NzbDrone.Core.Test/Framework/NBuilderExtensions.cs

26 lines
739 B
C#
Raw Normal View History

2013-03-28 06:54:01 +00:00
using System.Collections.Generic;
2013-03-28 06:49:38 +00:00
using System.Linq;
using FizzWare.NBuilder;
using NzbDrone.Core.Datastore;
2013-03-28 06:54:01 +00:00
namespace NzbDrone.Core.Test.Framework
2013-03-28 06:49:38 +00: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();
}
public static List<T> BuildList<T>(this IOperable<T> builder) where T : ModelBase, new()
{
return builder.Build().ToList();
}
public static List<T> BuildListOfNew<T>(this IOperable<T> builder) where T : ModelBase, new()
{
return BuildList<T>(builder.All().With(c => c.Id = 0));
}
}
}