using System; using System.Collections.Generic; using System.Linq; using Strata.Analytics.Biz.Extracts.Models; namespace Strata.Analytics.Test.Unit.Biz.TestData { internal static class ExtractTestData { private static readonly Guid UserGuid1 = Guid.NewGuid(); private static readonly Guid UserGuid2 = Guid.NewGuid(); private static readonly DateTimeOffset Now = DateTimeOffset.UtcNow; private static readonly DateOnly NowDate = DateOnly.Parse(DateTime.Today.ToShortDateString()); private static readonly TimeOnly NowTime = TimeOnly.Parse(DateTime.Today.ToShortTimeString()); public static IQueryable Extracts() { var extracts = new List { new() { ExtractId = 1, Name = "Extract 1", Description = "This is Extract 1", ExtractType = ExtractType.CustomSql, RawSql = "SELECT * FROM ALLTABLES", CreatedByUserGuid = UserGuid1, UpdatedByUserGuid = UserGuid1, CreatedDate = Now.AddDays(-1), UpdatedDate = Now.AddHours(-1) }, new() { ExtractId = 2, Name = "Extract 2", Description = "This is Extract 2", ExtractType = ExtractType.CustomSql, RawSql = "SELECT * FROM JustTheOneTable", CreatedByUserGuid = UserGuid1, UpdatedByUserGuid = UserGuid1, CreatedDate = Now.AddDays(-1), UpdatedDate = Now.AddHours(-1) } }; return extracts.AsQueryable(); } public static IQueryable ExtractExportHistories() { var extractExportHistories = new List { new() { ExtractHistoryId = 101, ExtractId = 1, OutputFilename = "ExtractExportHistory 101", ExportStartDate = Now.AddDays(-3).AddMinutes(-50), ExportEndDate = Now.AddDays(-3).AddMinutes(-5), SqlExecuted = "This is the Sql Executed", TotalFileSize = 1024, TotalRowCount = 8675309, CreatedByUserGuid = UserGuid1, CreatedDate = Now.AddDays(-3), }, new() { ExtractHistoryId = 102, ExtractId = 1, OutputFilename = "ExtractExportHistory 102", ExportStartDate = Now.AddDays(-2).AddMinutes(-50), ExportEndDate = Now.AddDays(-2).AddMinutes(-4), SqlExecuted = "This is the Sql Executed", TotalFileSize = 1025, TotalRowCount = 8675310, CreatedByUserGuid = UserGuid1, CreatedDate = Now.AddDays(-2), }, new() { ExtractHistoryId = 103, ExtractId = 1, OutputFilename = "ExtractExportHistory 103", ExportStartDate = Now.AddDays(-1).AddMinutes(-50), ExportEndDate = Now.AddDays(-1).AddMinutes(-1), SqlExecuted = "This is the Sql Executed", TotalFileSize = 1500, TotalRowCount = 9000001, CreatedByUserGuid = UserGuid1, CreatedDate = Now.AddDays(-1), }, new() { ExtractHistoryId = 201, ExtractId = 2, OutputFilename = "ExtractExportHistory 201", ExportStartDate = Now.AddDays(-3).AddMinutes(-3), ExportEndDate = Now.AddDays(-3).AddMinutes(-1), SqlExecuted = "This is the Sql Executed", TotalFileSize = 9890498, TotalRowCount = 106840864650680, CreatedByUserGuid = UserGuid2, CreatedDate = Now.AddDays(-3), }, new() { ExtractHistoryId = 202, ExtractId = 1, OutputFilename = "ExtractExportHistory 102", ExportStartDate = Now.AddMinutes(-1), ExportEndDate = Now.AddSeconds(-1), SqlExecuted = "This is the Sql Executed", TotalFileSize = 1025, TotalRowCount = 8675310, CreatedByUserGuid = UserGuid2, CreatedDate = Now.AddDays(-2), } }; return extractExportHistories.AsQueryable(); } public static IQueryable ExtractSchedules() { var schedules = new List { new() { ExtractId = 1, ExtractScheduleId = 1, Enabled = true, Repeater = ScheduleRepeaterType.Daily, OnDays = "", StartDate = NowDate, StartTime = NowTime, EndDate = NowDate.AddYears(1), CreatedByUserGuid = UserGuid1, UpdatedByUserGuid = UserGuid1, CreatedDate = Now.AddDays(-1), UpdatedDate = Now.AddDays(-1), LastRunDate = Now }, new() { ExtractId = 2, ExtractScheduleId = 2, Enabled = true, Repeater = ScheduleRepeaterType.Weekly, OnDays = "MON,WED,FRI", StartDate = NowDate, StartTime = NowTime, MaxOccurrences = 12, CreatedByUserGuid = UserGuid2, UpdatedByUserGuid = UserGuid2, CreatedDate = Now.AddDays(-1), UpdatedDate = Now.AddDays(-1), LastRunDate = Now }, new() { ExtractId = 3, ExtractScheduleId = 3, Enabled = true, Repeater = ScheduleRepeaterType.Monthly, OnDays = "", StartDate = NowDate, StartTime = NowTime, MaxOccurrences = 12, CreatedByUserGuid = UserGuid2, UpdatedByUserGuid = UserGuid2, CreatedDate = Now.AddDays(-1), UpdatedDate = Now.AddDays(-1), LastRunDate = Now } }; return schedules.AsQueryable(); } } }