public MonthSheetRepository(IOptions <MonthSheetDetails> sheetDetails, ISheetApiService sheetApi) : base(sheetDetails.Value.SheetId, sheetApi) { _sheetDetails = sheetDetails.Value; _sheetApi = sheetApi ?? throw new ArgumentNullException(nameof(sheetApi)); var missingDetail = _sheetDetails.GetType().GetProperties() .Where(p => p.PropertyType == typeof(string)) .Select(p => (name: p.Name, value: (string)p.GetValue(_sheetDetails))) .FirstOrDefault(r => string.IsNullOrEmpty(r.value)); if (!string.IsNullOrEmpty(missingDetail.name)) { throw new ArgumentNullException($"Missing Month detail: {missingDetail.name}"); } }
public BaseYearRepository(string sheetId, ISheetApiService sheetApi) : base(sheetId, sheetApi) { _sheetApi = sheetApi ?? throw new ArgumentNullException(nameof(sheetApi)); }
public YearSheetRepositoryFactory(IOptions <YearSheetDetails> sheetDetails, ISheetApiService sheetApi) { _sheetDetails = sheetDetails.Value; _sheetApi = sheetApi; }
public RepoInstance(string sheetId, ISheetApiService sheetApi) : base(sheetId, sheetApi) { }
private static RepoInstance GetRepoInstance(string sheetId = null, ISheetApiService sheetApi = null) { return(new RepoInstance(sheetId ?? new Faker().Lorem.Word(), sheetApi ?? SheetApiMocker.GetService())); }
private static SheetRepositoryBase GetRepoBase(string sheetId = null, ISheetApiService sheetApi = null) { return(new SheetRepositoryBase(sheetId ?? new Faker().Lorem.Word(), sheetApi ?? SheetApiMocker.GetService())); }
public void Constructor_with_NullArguments_throws_ArgumentNullException( string sheetId, ISheetApiService sheetApi) => Assert.Throws <ArgumentNullException>( () => new SheetRepositoryBase(sheetId, sheetApi));
// TODO: write tests for this base class public SheetRepositoryBase(string SheetId, ISheetApiService sheetApi) { _sheetId = SheetId ?? throw new ArgumentNullException("Sheet Id");; _sheetApi = sheetApi ?? throw new ArgumentNullException(nameof(sheetApi)); }
private static IMonthSheetRepository GetMonthRepo(IOptions <MonthSheetDetails> sheetDetails = null, ISheetApiService sheetApi = null) { return(new MonthSheetRepository(sheetDetails ?? MonthSheetDetailMocker.GetPassing(), sheetApi ?? SheetApiMocker.GetService())); }
public void Constructor_with_NullArguments_throws_ArgumentNullException( IOptions <MonthSheetDetails> details, ISheetApiService sheetApi) => Assert.Throws <ArgumentNullException>( () => new MonthSheetRepository(details, sheetApi));
public YearSheetRepository(string sheetId, YearSheetDetails sheetDetails, ISheetApiService sheetApi) : base(sheetId, sheetApi) { _sheetApi = sheetApi ?? throw new ArgumentNullException(nameof(sheetApi)); _sheetDetails = sheetDetails; }