public void GetHeaderReturnsWithHeaderWithNullsTest() { var containerItem = new TestItemContainer { Items = new List <TestItem> { new TestItem { Field1 = "field1" }, new TestItem { Field1 = "another field" }, new TestItem { Field1 = null } } }; var pivot = new ListPivot <TestItemContainer, TestItem>( "test", x => x.Items, x => x.Field1, x => x.Field2); var writer = ListPivotWriter <TestItemContainer, TestItem> .GetWriter( new List <TestItemContainer> { containerItem }, pivot); var header = writer.GetHeader(); Assert.Equal("field1,another field,", header); }
public void GetLineThrowsWithMultipleIdenticalHeaderValuesTest() { var containerItem = new TestItemContainer { Items = new List <TestItem> { new TestItem { Field1 = "field1" }, new TestItem { Field1 = "field1" } } }; var pivot = new ListPivot <TestItemContainer, TestItem>( "test", x => x.Items, x => x.Field1, x => x.Field2); var writer = ListPivotWriter <TestItemContainer, TestItem> .GetWriter( new List <TestItemContainer> { containerItem }, pivot); var ex = Assert.Throws <InvalidOperationException>( () => writer.GetLine(containerItem)); Assert.Equal("cannot have two identical column names", ex.Message); }