internal static string GetContextId(Excel.Workbook workbook) { if (null == workbook) { throw new ArgumentNullException("workbook"); } return(ExcelWorkbookCustomPropertyAccessor.Get(workbook, ID_PROPERTY) ?? string.Empty); }
public WorkbookContext(Excel.Workbook workbook) { if (null == workbook) { throw new ArgumentNullException("workbook"); } this.Workbook = workbook; this.Id = GetContextId(workbook); if (string.IsNullOrWhiteSpace(this.Id)) { this.Id = Guid.NewGuid().ToString(); ExcelWorkbookCustomPropertyAccessor.Set(workbook, ID_PROPERTY, this.Id); } this.TestCases = new TestCaseCollection(); this.settings = WorkbookContextSettings.Load(this.Workbook); this.Update(); }