Skip to content

Commit

Permalink
Fixes #470 issue with obs data (#471)
Browse files Browse the repository at this point in the history
  • Loading branch information
msevestre authored Nov 27, 2018
1 parent d94a342 commit 5c9987e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ public void AddData(int rowIndex)
/// <returns></returns>
public IEnumerable<string> GetCellValidationErrorMessages(int rowIndex, int columnIndex, string newValue)
{
if (string.IsNullOrWhiteSpace(newValue))
return new[] {Error.ValueIsRequired};

var proposedValue = newValue.ConvertedTo<float>();
var editedColumnId = GetColumnIdFromColumnIndex(columnIndex);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,24 @@ public void should_not_return_validation_messages()
}
}

public class When_getting_validation_messages_for_an_empty_value : concern_for_DataRepositoryDataPresenter
{
private List<string> _result;

protected override void Because()
{
sut.EditObservedData(_dataRepository);
_result = sut.GetCellValidationErrorMessages(0, 1, " ").ToList();
}

[Observation]
public void should_return_validation_messages()
{
_result.Count.ShouldBeEqualTo(1);
_result[0].ShouldBeEqualTo(Error.ValueIsRequired);
}
}

public class When_getting_validation_messages_for_repeated_basegrid_values : concern_for_DataRepositoryDataPresenter
{
private List<string> _result;
Expand Down

0 comments on commit 5c9987e

Please sign in to comment.