1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00
Sonarr/NzbDrone.Test.Common/NBuilderExtensions.cs
2013-03-27 23:49:38 -07:00

26 lines
734 B
C#

using System.Collections.Generic;
using System.Linq;
using FizzWare.NBuilder;
using NzbDrone.Core.Datastore;
namespace NzbDrone.Test.Common
{
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));
}
}
}