public async Task ImportAsync_MustImportRulesHolidaysFromCsvFile_True(string file) { // Arrange string filename = Helper.GetFilePath(file); IImportRuleHolidayService ruleHolidayService = Helper.GetImportRuleHolidayService(); // // Act // var result = await ruleHolidayService.ImportAsync(filename); // Assert Assert.True(result.Success); if (result.Success) { List <List <RuleHoliday> > rulesHolidays = (List <List <RuleHoliday> >)result.Data; Assert.NotNull(rulesHolidays); Assert.True(rulesHolidays.Count > 0); for (int i = 0, j = rulesHolidays.Count; i < j; i++) { Assert.True(rulesHolidays[i].Count > 0); } } }
public async Task <IActionResult> RuleHoliday([FromRoute] Guid token) { CommandResponse commandResponse; Stopwatch watch = Stopwatch.StartNew(); if (!ModelState.IsValid) { commandResponse = FormatResponse(ModelState); } else { CommandResult commandResult; if (token != _bigaiId) { commandResult = CommandResult.Unauthorized("Authorization token is not valid."); } else { commandResult = UploadCsv(); if (commandResult.Success) { commandResult = await _importRuleHolidayService.ImportAsync(commandResult.Data.ToString()); } } commandResponse = FormatResponse(commandResult); } watch.Stop(); commandResponse.ElapsedTime = watch.ElapsedMilliseconds; return(StatusCode(commandResponse.StatusCode, commandResponse)); }
public async Task ImportAsync_MustImportRulesHolidaysFromCsvFile_False(string file) { // Arrange string filename = Helper.GetFilePath(file); IImportRuleHolidayService ruleHolidayService = Helper.GetImportRuleHolidayService(); // // Act // var result = await ruleHolidayService.ImportAsync(filename); // Assert Assert.False(result.Success); }