public void CodeBookServiceGetTest() { CodeBookReaderService service = new CodeBookReaderService(); CodeBookCollection source = service.Get(); Assert.NotNull(source); Assert.NotEmpty(source.Items); }
public void CodeBookValidateItemTest(string key, string value) { CodeBookReaderService service = new CodeBookReaderService(); CodeBookCollection source = service.Get(); bool flag = source.IsValidValue(key, value, out string message); Assert.True(flag, message); }
public void CodeBookFailedItemTest(string key, string value) { CodeBookReaderService service = new CodeBookReaderService(); CodeBookCollection source = service.Get(); bool flag = source.IsValidValue(key, value, out string message); Assert.False(flag); this.Output.WriteLine(message); }
/// <summary> /// This function returns <see cref="CodeBookCollection"/> collection retried from /// CSV source file. /// </summary> /// <returns>The <see cref="CodeBookCollection"/> items collection.</returns> public CodeBookCollection Get() { if (string.IsNullOrEmpty(this.FileName)) { throw new ArgumentNullException($"The file name of the source is not defined."); } List <CodeBookProfiler> source = this.GetCsvData <CodeBookProfiler, CodeBookProfilerMap>(this.FileName); CodeBookCollection target = new CodeBookCollection(); foreach (CodeBookProfiler item in source) { target.Add(item.FieldName, item.Value, item.DescriptionLocalized); } return(target); }