﻿using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;

namespace SSCases
{
    internal static class HelpExtensions
    {
        public static IEnumerable<TestCaseData> SelectCasesForExistsFrom(IEnumerable<Case> source)
        {
            return source.Select(@case => new TestCaseData(@case.Pattern, @case.Sequence)
                                                  .Returns(@case.Result.Exists));
        }

        public static IEnumerable<TestCaseData> SelectCasesForFindFirstFrom(IEnumerable<Case> source)
        {
            return source.Select(@case => new TestCaseData(@case.Pattern, @case.Sequence)
                                                  .Returns(@case.Result.FindFirst));
        }

        public static IEnumerable<TestCaseData> SelectCasesForFindLastFrom(IEnumerable<Case> source)
        {
            return source.Select(@case => new TestCaseData(@case.Pattern, @case.Sequence)
                                                  .Returns(@case.Result.FindLast));
        }

        public static IEnumerable<TestCaseData> SelectCasesForFindAllFrom(IEnumerable<Case> source)
        {
            return source.Select(@case => new TestCaseData(@case.Pattern, @case.Sequence)
                                                  .Returns(@case.Result.FindAll));
        }
    }
}
