public void op_Line_KeyStringDictionaryNull_IListOfString() { var columns = new List<string> { "A" }; Assert.Throws<ArgumentNullException>(() => Csv.Line(null, columns)); }
public void op_Line_IEnumerableString_whenEmptyValue() { var obj = new List<string> { string.Empty, "left,right" }; const string expected = ",\"left,right\""; var actual = Csv.Line(obj); Assert.Equal(expected, actual); }
public void op_Line_IEnumerableString() { var obj = new List<string> { "123", "left,right" }; const string expected = "123,\"left,right\""; var actual = Csv.Line(obj); Assert.Equal(expected, actual); }
public void op_Line_KeyStringDictionary_whenEmptyValue() { var obj = new KeyStringDictionary { new KeyStringPair("A", string.Empty), new KeyStringPair("B", "left,right") }; const string expected = ",\"left,right\""; var actual = Csv.Line(obj); Assert.Equal(expected, actual); }
public void op_Line_KeyStringDictionary_IListOfString() { var obj = new KeyStringDictionary { new KeyStringPair("A", "123"), new KeyStringPair("B", "ignore"), new KeyStringPair("C", "left,right") }; const string expected = "123,\"left,right\""; var actual = Csv.Line(obj, "A,C".Split(',').ToList()); Assert.Equal(expected, actual); }
public void op_Line_KeyStringDictionary() { var obj = new KeyStringDictionary { new KeyStringPair("A", "123"), new KeyStringPair("B", "left,right"), new KeyStringPair("C", "a \"b\" c"), }; const string expected = "123,\"left,right\",\"a \"\"b\"\" c\""; var actual = Csv.Line(obj); Assert.Equal(expected, actual); }
public void op_GetEnumerator_whenSheet1() { using (var temp = new TempDirectory()) { var file = temp.Info.ToFile("{0}.xlsx".FormatWith(AlphaDecimal.Random())); new DirectoryInfo(Environment.CurrentDirectory).ToFile("Example.xlsx").CopyTo(file.FullName); var sheet = new ExcelDataSheet(file) { Title = "Sheet1" }; var data = sheet.ToList(); Assert.Equal(3, data.Count); Assert.Equal("Top Left,123,123.45,true", Csv.Line(data[0])); Assert.Equal("1969-03-10,456%,£456.78,", Csv.Line(data[1])); Assert.Equal("1969-03-10T01:02:03Z,,,false", Csv.Line(data[2])); } }
public void op_Line_IEnumerableStringNull() { Assert.Throws<ArgumentNullException>(() => Csv.Line(null as IEnumerable<string>)); }
public void op_Line_IEnumerableStringEmpty() { Assert.Throws<ArgumentOutOfRangeException>(() => Csv.Line(new List<string>())); }
public void op_Line_KeyStringDictionary_IListOfString_whenColumnsNotFound() { Assert.Throws<KeyNotFoundException>(() => Csv.Line(new KeyStringDictionary(), "A,B".Split(',').ToList())); }
public void op_Line_KeyStringDictionary_IListOfStringNull() { Assert.Throws<ArgumentNullException>(() => Csv.Line(new KeyStringDictionary(), null)); }
public void op_Line_KeyStringDictionary_IListOfStringEmpty() { Assert.Throws<ArgumentOutOfRangeException>(() => Csv.Line(new KeyStringDictionary(), new List<string>())); }
public void op_Line_KeyStringDictionaryNull() { Assert.Throws<ArgumentNullException>(() => Csv.Line(null as KeyStringDictionary)); }