private void CacheToggl() { WriteTimeLog("--CacheToggl", "Starting"); ITogglWorkspace efToggl = new EFTogglWorkspace(); efToggl.CacheEntries(); ITogglTimeEntries efTimeEntries = new EFTogglTimeEntries(); string workspace = _configuration.GetKey("APISources:Toggl:Workspace"); string fromDateDaysString = _configuration.GetKey("APISources:Toggl:FromDateDays"); int?fromDateDays = null; if (!String.IsNullOrEmpty(fromDateDaysString)) { try { fromDateDays = int.Parse(fromDateDaysString); } catch (Exception e) { throw new InvalidCastException( "Unable to convert the integer (intended) value in the APISources:Toggl:FromDateDays setting in the appSettings"); } } efTimeEntries.CacheEntries(workspace, fromDateDays); }
public void CacheEntries_ShouldCallGetWorkspacesAndSave() { EFTogglWorkspace efTogglWorkspace = new EFTogglWorkspace(_context.Object, _config.Object, _iAPIMethod.Object); efTogglWorkspace.CacheEntries(); _iAPIMethod.Verify(x => x.GetWorkspaces(), Times.Once); _context.Verify(x => x.SaveChanges(), Times.Once); }