public async Task GetDistro_WhenInvoked_LogsMethodInvoked() { var foldingUsers = new FoldingUser[0]; statsDownloadApiDataStoreServiceMock.GetFoldingMembers(startDateMock, endDateMock).Returns(foldingUsers); await systemUnderTest.GetDistro(startDateMock, endDateMock, amountMock); Received.InOrder(() => { loggingServiceMock.LogMethodInvoked(nameof(systemUnderTest.GetDistro)); statsDownloadApiTokenDistributionServiceMock.GetDistro(amountMock, foldingUsers); loggingServiceMock.LogMethodFinished(nameof(systemUnderTest.GetDistro)); }); }
public void GetFoldingMembers_WhenInvoked_GetsAndValidatesStatsFiles() { systemUnderTest.GetFoldingMembers(DateTime.MinValue, DateTime.MaxValue); Received.InOrder(() => { databaseServiceMock.Received(1).GetValidatedFiles(DateTime.MinValue, DateTime.MaxValue); filePayloadApiSettingsServiceMock.Received(1).SetFilePayloadApiSettings(Arg.Any <FilePayload>()); dataStoreServiceMock.Received(1).DownloadFile(Arg.Any <FilePayload>(), validatedFileMock1); fileValidationServiceMock.Received(1).ValidateFile(Arg.Any <FilePayload>()); filePayloadApiSettingsServiceMock.Received(1).SetFilePayloadApiSettings(Arg.Any <FilePayload>()); dataStoreServiceMock.Received(1).DownloadFile(Arg.Any <FilePayload>(), validatedFileMock3); fileValidationServiceMock.Received(1).ValidateFile(Arg.Any <FilePayload>()); }); }
private async Task <IList <FoldingUser> > GetFoldingMembers(DateTime?startDate, DateTime?endDate) { return(await statsDownloadApiDataStoreService.GetFoldingMembers(startDate.GetValueOrDefault(), endDate.GetValueOrDefault())); }
public Task <FoldingUser[]> GetFoldingMembers(DateTime startDate, DateTime endDate) { return(GetOrAdd(async() => await innerService.GetFoldingMembers(startDate, endDate), DateTimeOffset.Now.AddHours(cacheDurationInHours), $"{startDate}-{endDate}")); }