public void Row_RowWithDefaultValues() { //Arrange ------------ var r = new gt.Row(); //this is an internal constructor! //Act ----------------- //Assert -------------- Assert.IsNotNull(r); Assert.That(r.Cells.Count() == 0); Assert.That(r.ColumnTypes.Count() == 0); }
public void CanRemovePropertyByIndexFromThePropertyMap() { //Arrange ------------ var row = new gt.Row(); const string propertyName = "STYLE"; const string propertyValue = "border: 7px solid orange"; //Act ----------------- row.AddProperty(new Property(propertyName, propertyValue)); row.RemoveProperty(0); //Assert -------------- Assert.That(row.PropertyMap.Count() == 0); }
public void AddARangeOfCellsThatHaveMoreItemsThanColumnsRaisesException() { //Arrange ------------ var r = new gt.Row(); r.ColumnTypes = new List <ColumnType>() { ColumnType.Number }; Cell c = new Cell(100); Cell c2 = new Cell(200); //Act/Assert ----------------- Assert.Throws <ArgumentOutOfRangeException>(() => r.AddCellRange(new[] { c, c2 })); }
public void CanAddAndRetrieveAProperty() { //Arrange ------------ var row = new gt.Row(); const string propertyName = "STYLE"; const string propertyValue = "border: 7px solid orange"; //Act ----------------- var property = row.AddProperty(new Property(propertyName, propertyValue)); //Assert -------------- Assert.That(row.PropertyMap.ToList()[0].Name == propertyName); Assert.That((string)row.PropertyMap.ToList()[0].Value == propertyValue); Assert.That(property.Name == propertyName); Assert.That(property.Value == propertyValue); }
public void Row_CanAddACell() { //Arrange ------------ var r = new gt.Row(); r.ColumnTypes = new List <ColumnType>() { ColumnType.Number }; Cell c = new Cell(100, "100"); //Act ----------------- r.AddCell(c); //Assert -------------- Assert.That(r.Cells.Count() == 1); }
string GoogleChartData(IEnumerable <Keeper> keepers) { var dt = new Google.DataTable.Net.Wrapper.DataTable(); dt.AddColumn(new Column(ColumnType.Date, "Date", "Date")); dt.AddColumn(new Column(ColumnType.Number, "Count", "Count")); foreach (var item in keepers) { Google.DataTable.Net.Wrapper.Row row = dt.NewRow(); row.AddCellRange(new Cell[] { new Cell(item.Date), new Cell(item.Count), }); dt.AddRow(row); } return(dt.GetJson()); }
public void CanAddARangeOfCells() { //Arrange ------------ var r = new gt.Row(); r.ColumnTypes = new List <ColumnType>() { ColumnType.Number, ColumnType.Number }; Cell c = new Cell(100); Cell c2 = new Cell(200); //Act ----------------- r.AddCellRange(new[] { c, c2 }); //Assert -------------- Assert.That(r.Cells.Count() == 2); }