public void ShouldConvertToTableFromParameter() { var headers = new ProtoTableRow.Builder().AddRangeCells(new[] { "header" }).Build(); var cells = new ProtoTableRow.Builder().AddRangeCells(new[] { "Foo" }).Build(); var table = new ProtoTable.Builder().SetHeaders(headers).AddRangeRows(new[] { cells }); var parameter = new Parameter.Builder() .SetParameterType(Parameter.Types.ParameterType.Table) .SetTable(table).Build(); var actual = new TableParamConverter().Convert(parameter) as Table; Assert.NotNull(actual); Assert.That(actual.GetColumnNames(), Contains.Item("header")); Assert.That(actual.GetTableRows().First().GetCell("header"), Is.EqualTo("Foo")); }
public void ShouldConvertToTableFromParameter() { var headers = new ProtoTableRow.Builder().AddRangeCells(new[] { "header" }).Build(); var cells = new ProtoTableRow.Builder().AddRangeCells(new[] { "Foo" }).Build(); var table = new ProtoTable.Builder().SetHeaders(headers).AddRangeRows(new[] { cells }); var parameter = new Parameter.Builder() .SetParameterType(Parameter.Types.ParameterType.Table) .SetTable(table).Build(); var mockSandbox = new Mock <ISandbox>(); mockSandbox.Setup(sandbox => sandbox.GetTargetType(typeof(Table).FullName)).Returns(typeof(Table)); var actual = new TableParamConverter().Convert(parameter, mockSandbox.Object) as Table; Assert.NotNull(actual); Assert.That(actual.GetColumnNames(), Contains.Item("header")); Assert.That(actual.GetTableRows().First().GetCell("header"), Is.EqualTo("Foo")); }