chore: fix unit tests

l10n_develop
tidusjar 3 years ago
parent 0989774712
commit 29063894fe

@ -494,7 +494,7 @@ namespace Ombi.Core.Tests.Engine
MovieRequestLimitType = RequestLimitType.Month, MovieRequestLimitType = RequestLimitType.Month,
Id = "id1" Id = "id1"
}; };
var today = DateTime.UtcNow; var today = new DateTime(2022,2,2,13,0,0);
var firstDayOfMonth = new DateTime(today.Year, today.Month, 1); var firstDayOfMonth = new DateTime(today.Year, today.Month, 1);
var log = new List<RequestLog> var log = new List<RequestLog>
{ {

@ -494,7 +494,7 @@ namespace Ombi.Core.Tests.Engine
MusicRequestLimitType = RequestLimitType.Month, MusicRequestLimitType = RequestLimitType.Month,
Id = "id1" Id = "id1"
}; };
var today = DateTime.UtcNow; var today = new DateTime(2022, 2, 2, 13, 0, 0);
var firstDayOfMonth = new DateTime(today.Year, today.Month, 1); var firstDayOfMonth = new DateTime(today.Year, today.Month, 1);
var log = new List<RequestLog> var log = new List<RequestLog>
{ {

@ -82,7 +82,7 @@ namespace Ombi.Core.Services
} }
return await CalculateBasicRemaingRequests(user, limit, user.MovieRequestLimitType ?? RequestLimitType.Day, log, now); return await CalculateBasicRemaingRequests(limit, user.MovieRequestLimitType ?? RequestLimitType.Day, log, now);
} }
public async Task<RequestQuotaCountModel> GetRemainingMusicRequests(OmbiUser user, DateTime now = default) public async Task<RequestQuotaCountModel> GetRemainingMusicRequests(OmbiUser user, DateTime now = default)
@ -136,7 +136,7 @@ namespace Ombi.Core.Services
}; };
} }
return await CalculateBasicRemaingRequests(user, limit, user.MusicRequestLimitType ?? RequestLimitType.Day, log, now); return await CalculateBasicRemaingRequests(limit, user.MusicRequestLimitType ?? RequestLimitType.Day, log, now);
} }
private async Task<OmbiUser> GetUser() private async Task<OmbiUser> GetUser()
@ -145,7 +145,7 @@ namespace Ombi.Core.Services
return await _userManager.Users.FirstOrDefaultAsync(x => x.NormalizedUserName == username); return await _userManager.Users.FirstOrDefaultAsync(x => x.NormalizedUserName == username);
} }
private static async Task<RequestQuotaCountModel> CalculateBasicRemaingRequests(OmbiUser user, int limit, RequestLimitType type, IQueryable<RequestLog> log, DateTime now) private static async Task<RequestQuotaCountModel> CalculateBasicRemaingRequests(int limit, RequestLimitType type, IQueryable<RequestLog> log, DateTime now)
{ {
int count = 0; int count = 0;
DateTime oldestRequestedAt = DateTime.Now; DateTime oldestRequestedAt = DateTime.Now;

Loading…
Cancel
Save